I need to use a normalized temperature value, to check if someone has an illness.
I have written a function that converts from Celsius to Fahrenheit, but need to write the same function using normalized temperatures.
public void hasFever(int temperature1, int temperature2, int temperature3, int temperature4, String bodylocation) throws ArithmeticException, InputMismatchException {
final int noOfTimesTempTaken = 4;
if(bodylocation == "ear") { //Determine if someone has fever if temperature was taken by the ear
final double feverTemperature = 98.6;
double temperature1InFahrenheit = (temperature1 * 9/5) + 32;
double temperature2InFahrenheit = (temperature2 * 9/5) + 32;
double temperature3InFahrenheit = (temperature3 * 9/5) + 32;
double temperature4InFahrenheit = (temperature4 * 9/5) + 32;
double avgTemp = (temperature1InFahrenheit + temperature2InFahrenheit + temperature3InFahrenheit + temperature4InFahrenheit) / noOfTimesTempTaken;
if(avgTemp >= feverTemperature) {
System.out.println("This person has a fever because their temperature of " + avgTemp + " is greater than normal which is 98.6");
} else {
System.out.println("This person does not have a fever because their temperature of " + avgTemp + " is less than normal which is 98.6");
}
}
}