by using scanner classWrite a program to input the temperature in Celsius and convert it into Fahrenheit. If
the temperature is more than 98.6 °F then display "Fever" otherwise "Normal" by using scanner class
Answers
Answered by
2
public class Pro{
public static void main ( String[] args ){
Scanner sc = new Scanner (System.in);
System.out.println("Enter 1 to input temparature in farenheit or 2 to enter in Celsius");
int ch = sc.nextInt( );
switch (ch){
case 1:
System.out.println("Enter temparature");
int temp = sc.nextint( );
if (temp > 98.6)
System.out.println("Fever");
else
System.out.println("Not Fever");
break;
case 2:
System.out.println("Enter temparature");
int temp = sc.nextint( );
temp = (9/5)*temp+32;
if (temp > 98.6 )
System.out.println("Fever");
else
System.out.println("Not Fever");
break;
}
}
}
Similar questions
English,
1 month ago
Math,
1 month ago
Math,
2 months ago
Computer Science,
2 months ago
Math,
9 months ago