CheckTemperature 4-4

Post date: Feb 1, 2014 5:37:20 PM

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package checktemperature4.pkg4;

import java.util.Scanner;

public class CheckTemperature44 {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

final double MAX_TEMP = 102.5 ; // Maximum temperature

double temperature; // To hold the temperature

// Create a Scanner object for keyboard input.

Scanner keyboard = new Scanner(System.in);

// Get the current temperature.

System.out.print("Enter the substance's Celsius temperature: ");

temperature = keyboard.nextDouble();

// As long as necessary, instruct the technician

// to adjust the temperature.

while (temperature > MAX_TEMP)

{

System.out.println("The temperature i s too high. Turn the");

System.out.println("thermostat down and wait 5 minutes.");

System.out.println("Then, take the Celsius temperature again");

System.out.print("and enter it here: ");

temperature = keyboard.nextDouble();

}

// Remind the technician to check the temperature

// again in 15 minutes.

System.out.println("The temperature i s acceptable.");

System.out.println("Check i t again in 15 minutes.");

}

}