Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lessons;
- import java.util.Scanner;
- public class CheckTemp
- {
- public static void main(String[] args)
- {
- //check temp, if >102.5 warn its too high to wait then enter a lower temp
- // if lower than 102.5 check again in 8 min
- Scanner keyboard = new Scanner(System.in);
- System.out.println("enter temp:");
- double temp = keyboard.nextDouble();
- final double MAX_TEMP = 102.5;
- while (temp> MAX_TEMP)
- {
- System.out.println("too hot, turn thermostat down and wait 5 min then try again:");
- System.out.println("enter temp:");
- temp = keyboard.nextDouble();
- }
- System.out.println("temp is acceptable, enter again in 15 min");
- keyboard.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement