import java.io.*;
import java.text.*;
// Application that gives advice for patient with a fever.
public class MedicalAdvice
{
public static void main (String []
args)
{
Advice advice
= new Advice ();
advice.readData
();
advice.classifyTemperature
();
} // method main
} // class MedicalAdvice
class Advice
{
private int temperature = 0;
public void readData ()
{
System.out.print
( "Enter your temperature. ");
try
{
BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
temperature = Integer.parseInt (stdin.readLine ());
}
catch (IOException
e) { System.out.println ("I/O error");}
catch (NumberFormatException
ex) { System.out.println ("Number format error.");}
} // method readData
// Method to analyse a patient's temperature.
public void classifyTemperature ()
{
switch (temperature)
{
case 105: case 106:
System.out.println ( "Medical emergency, go to the hospital." );
break;
case 101: case 102: case 103: case 104:
System.out.println ( "High temperature, see a doctor." );
break;
case 99: case 100:
System.out.println ( "Mild fever, take two aspirin and go to bed." );
break;
case 97: case 98:
System.out.println ( "Temperature normal." );
break;
default:
System.out.println ( "Either your temperature is low or it's terribly high."
);
} // switch
} // classifyTemperature
} // class Advice