Problems: #7 through 9 points each* The following problems generate temperature-
ID: 3810811 • Letter: P
Question
Problems: #7 through 9 points each* The following problems generate temperature-conversion tables. Use the following equations that give relationships between temperatures in degrees Fahrenheit (TF), degrees Celsius (TC), TF TR-459.67 degrees R TF (9/5)TC 32 degrees F Write a program to generate a table of conversions from Fahrenheit to Celsius for values from 7. 00 Fahrenheit to 100 Fahrenheit. Print a line in the table for each 5-degree change. Use a while loop in your solution. The display should look something like below. ote middle of display below is missing Degrees F Degrees C 17.7778 100 37.7778 8. Write a program to generate a table of conversions from Fahrenheit to Kelvin for values from 0° Fahrenheit to 200 Fahrenheit. Allow the user to enter the increment in degrees Fahrenheit between lines. Use a do-while loop in your solution Test with an increment of 10 The display should look something like below (Note middle of display below is missing. Degrees F Degrees K. 255.372 200 366.483 Write a program to generate a table of conversions from Celsius to Rankin. Allow the user to 9.Explanation / Answer
You need to have the basic knowlede of the the loops and how the loops works
Here is the syntax:::::::::::::::::::
And here is the program
Using while loop:::::::::::::::::::::::::::::::::::::::::
import java.util.*;
class Converter {
public static void main (String[] args) {
int i = 0;
System.out.println("Degree F"+" "+"Deree C");
while(i<=100){
double TF = i;
double TC = (TF-32.0)*(double)(5.0/9.0);
TC = Math.round(TC * 10000.0) / 10000.0;
System.out.println((int)TF+" "+TC);
i++;
}
}
}
Using for loop::::::::::::::::::::::::::::::::::::::::::::::::::::::;
import java.io.*;
class GFG {
public static void main (String[] args) {
System.out.println("Degree C"+" "+"Deree R");
for(int i = 100 ; i<=350 ;i++){
int TC = i;
double TR = ((9.0/5.0) * TC + 491.67);
TR = Math.round(TR * 1000.0) / 1000.0;
System.out.println(TC+" "+TR);
}
}
}
Using do while loop::::::::::::::::::::::::::::::::::::::::::::::::::::
import java.io.*;
class Converter{
public static void main (String[] args) {
//code
int i = 0;
System.out.println("Degree F"+" "+"Deree K");
do{
int TF = i;
double TK = (TF+459.67)*(double)(5.0/9.0);
TK = Math.round(TK * 1000.0) / 1000.0;
System.out.println(TF+" "+TK);
i++;
}while(i<=200);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.