Start and finish if possible the following programs GET INPU
Solution
Program
import java.util.Scanner;
public class TemperatureConversion {
//define all temperature parameters
static float kelvinTemp,fahrenheitTemp,rankinTemp;
public static void main(String[] args) {
//for taking custom input in kelvins
Scanner s= new Scanner(System.in);
System.out.print(\"Enter The Kelvin Temperature : \");
kelvinTemp=s.nextFloat();
//Compute Rankin Temperature TR=(9/5)*TK
rankinTemp=((float)9/5)*kelvinTemp;
//Compute Fahrenheit Temperature TF=TR-459.67
fahrenheitTemp =(float) (rankinTemp-459.67);
//Printing the output
System.out.println(\"For Kelvin Temperature \"+kelvinTemp+\" Rankin Temperature Is :\"+rankinTemp+\" and Fahrenheit Temperature Is : \"+fahrenheitTemp);
}
}
Outputs
Enter The Kelvin Temperature : 610
For Kelvin Temperature 610.0 Rankin Temperature Is :1098.0 and Fahrenheit Temperature Is : 638.33
Enter The Kelvin Temperature : 500
For Kelvin Temperature 500.0 Rankin Temperature Is :900.0 and Fahrenheit Temperature Is : 440.33
Enter The Kelvin Temperature : 120
For Kelvin Temperature 120.0 Rankin Temperature Is :216.0 and Fahrenheit Temperature Is : -243.67
