Temperature class to know whether patient has fever or not a
Temperature class to know whether patient has fever or not and how to take a reading for every one hour and what location is the reading taken. in java
Solution
Hi, Please find my code.
Please let me know in case of any issue.
import java.util.Scanner;
public class Temperature {
public static void main(String[] args) {
// scanner object to take user input
Scanner sc = new Scanner(System.in);
// taking location input
System.out.print(\"Enter location: \");
String location = sc.nextLine();
// taking temperature input in celcius
System.out.print(\"Enter your body temperature in celcius: \");
double temp = sc.nextDouble();
// Since you have not given a criteria of fever, I am taking standard one
// according to standard unit: if temperature is equal and greater than 38 C, then it is
// condition of fever
if(temp >= 38)
System.out.println(\"Your body temperture is \"+temp+\". You have fever\");
else
System.out.println(\"Your body temperture is \"+temp+\". You don\'t have fever\");
System.out.println(\"Your location is: \"+location);
}
}
/*
Sample output:
Enter location: Calfornia
Enter your body temperature in celcius: 37.9
Your body temperture is 37.9. You don\'t have fever
Your location is: Calfornia
*/

