Start and finish if possible the following programs GET INPUT FROM THE USER AND
ID: 3788897 • Letter: S
Question
Start and finish if possible the following programs GET INPUT FROM THE USER AND OUTPUT A meaningful answer as illustrated below. Just use plain approach with formats like and be sure to document your program and its important lines also with good variable names not abbreviations. Print up with output of three runs for each program. (Save output in a file then attach at the end of the program listing to print. Here always output the input with the calculations. Remember COMMENTS TO YOU AND USER FOR FULL CREDIT e g output. The area of the triangle with base 10 and height 5 centimeters is 25 square centimeters I-P Write a program that converts degrees Kelvin (TK) to degrees Fahrenheit (TF). And you also know that degrees Rankin (TR) is related to TK by TR-(9/5)TK and you Recall TF TR-459.67. Output the Fahrenheit and Rankin equivalent to the input Kelvin temperature. Rankin equivalent to the input Fahrenheit temperature.Explanation / Answer
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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.