Write 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". Using BlueJ
Answers
import java.io.*;
public class KboatTemperature
{
public static void main(String args[]) throws IOException {
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(read);
System.out.print("Enter temperature in Celsius: ");
double cel = Double.parseDouble(in.readLine());
double far = 1.8 * cel + 32;
if (far > 98.6)
System.out.println("Fever");
else
System.out.println("Normal");
}
Answer:
import java.io.*;
public class Temperature
{
public static void main(String args[]) throws IOException {
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(read);
System.out.print("Enter temperature in Celsius: ");
double celcius = Double.parseDouble(in.readLine());
double fahrenheit= (9 * (celcius/5)) + 32;
if (fahrenheit> 98.6)
{
System.out.println("Fever");
}
else
{
System.out.println("Normal");
}
}
}