In: Computer Science
Write this code in java and don't forget to comment every step.
Write a method which asks a baker how hot their water is, and prints out whether it is OK to make bread with the water. If the water is at or above 110F, your method should print "Too Warm." If the water is below 90.5F, print "Too Cold." If it is in between, print "Just right to bake!"
For example, if the user inputs the number 100.5, the program should print "Just right to bake!"
import java.util.Scanner; public class WaterStatus { public static void printStatus(){ // Creating Scanner object Scanner scan = new Scanner(System.in); // printing message System.out.print("how hot their water? "); // reading input float temp = scan.nextFloat(); // If the water is at or above 110F if(temp>=110){ // print "Too Warm." System.out.println("Too Warm."); } // If the water is below 90.5F else if(temp<90.5){ // print "Too Cold." System.out.println("Too Cold."); } // If it is in between else{ // print "Just right to bake!" System.out.println("Just right to bake!"); } } public static void main(String[] args) { // Making function call printStatus(); } }