Computer Science, asked by ak8829009, 5 months ago

(c) If temperature is input through the keyboard in Fahrenheit degrees, write a program which determine how is the atmosphere according to the following rules:

• if temperature is above 40 degrees centigrade------------------Very hot

• if temperature is between 35 & 40 degrees centigrade--------Tolerable

• if temperature is between 30 & 35 degrees centigrade--------Warm

• if temperature is between 30 & 10 degrees centigrade--------Cool

• if temperature is between 10 & 04 degrees centigrade--------Cold

• if temperature is less than 04 degrees centigrade---------------Coldest

Answers

Answered by kamalrajatjoshi94
2

Answer:

import java.util.*;

public class Temperature

{

public static void main(String args[ ])

{

Scanner in=new Scanner(System.in);

double tf,tc=0.0;

System.out.println("Enter the temperature in Fahrenheit");

tf=in.nextDouble();

tc=5.0/9.0*(tf-32); //Formula

System.out.println("The temperature in Celsius="+tc);

if(tc>40)

{

System.out.println("Very hot");

}

else if(tc>35&&tc<=40)

{

System.out.println("Tolerable");

}

else if(tc>30&&tc<=35)

{

System.out.println("Warm");

}

else if(tc>10&&tc<=30)

{

System.out.println("Cool");

}

else if(tc>4&&tc<=10)

{

System.out.println("Cold");

}

else if(tc<4)

{

System.out.println("Coldest");

}

}

}

Similar questions