// Application that gives advice for patient with a fever.
import java.io.*;
import java.text.*;
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 ()
{
if (temperature
>= 105)
System.out.println ( "Medical emergency, go to the hospital." );
else if (temperature
>= 101)
System.out.println ( "High temperature, see a doctor." );
else if (temperature
>= 99)
System.out.println ( "Mild fever, take two aspirin and go to bed." );
else if (temperature
>= 97)
System.out.println ( "Temperature normal." );
else
System.out.println ( "Your temperature is low, take a warm bath." );
} // classifyTemperature
} // class Advice