Respuesta :
Explanation:
Here's my solution:
import java.util.Scanner; // We start by importing the Scanner, which enables us to put in values
public class Main // our class. Name doesn't really matter here.
{ // Open the brackets of the class.
public static void main(String[] args) { // This is our main method. It will run when we run the class.
System.out.println("Starting Taffy Timer..."); // When we start the timer, we will print out that we do so
Scanner re = new Scanner(System.in); // Import the scanner into the main method
int temp; // Define the integer called temperature that the user will put in
do { /* This is a do while loop -- it will go through the loop, and then it will check the value.
I decided to use this because we can define temperature without checking the value first.
What this loop is doing is taking in the temperature, and then checking if it's right. If
it's a high enough temperature, it will tell the user that it's ready, but if not, it won't. */
temp = re.nextInt(); // Allow the user to enter in the temperature
if(temp >= 270) { // if it's high enough, say that it's ready
System.out.println("Your taffy is ready for the next step!");
}
else { // if not, don't
System.out.println("The mixture isn't ready yet.");
}
}
while(temp < 270); // This makes sure that if it's ready for the next step, we don't have to continue
}
}
The program is an illustration of loops.
Loops are used for repetitive operations;
The program in Java, where comments are used to explain each line is as follows:
import java.util.*;
public class Main{
public static void main(String[] args) {
//This creates a Scanner object
Scanner input = new Scanner(System.in);
//This declares temperature as integer
int temp;
//This prompts the user for input
System.out.print("Starting Taffy Timer...\nEnter the temperature: ");
//This gets the input from the user
temp = input.nextInt();
//The following iteration is repeated until the user enters at least 270
while(temp<270){
//This prompts the user for another input
System.out.print("The mixture isn't ready yet.\nEnter the temperature: ");
//This gets another input from the user
temp = input.nextInt();
}
//This is printed, when the user enters at least 270
System.out.print("Your taffy is ready for the next step!");
}
}
The above program is implemented using a while loop
Read more about similar programs at:
https://brainly.com/question/14168935