Create a program that will compute and generate a table of coversions from Celsi
ID: 3758186 • Letter: C
Question
Create a program that will compute and generate a table of coversions from Celsius to Fahrenheit. The program user to select the lowest and highest temperatures in Celsius and the incremental temperature change. The Mathematical relationship : ( degree_fahrenheit = (9/5)*degrees_celsius+32 )....The program should use loop to calculate and display result: Example if you input the range of degrees_celsius is from 0 to 10 and the increment is 2, then the corresponding Fahrenheit values should be calculated using the formula and dispayed both the temperatures in Celsius and temperature in Fahrenheit in the same line:
Celsius Value Fahrenheit Value 0.000000 32.000000
2.000000 35.599998
4.000000 39.200001
............. ..............
10.00000 50.000000
*Ask the user to input a celsuis value and ending celsius value and the incremental value, then use a for loop to calculate and display the required values.
* Use integer for Celsius and float Fahrenheit
* Program should use a loop to print the temperaure conversion table
*Indent only three spaces
Explanation / Answer
import java.util.*;
class celsuis
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int cel1, cel2;
double degree_fahrenheit;
System.out.println("Enter Celsuis starting number : ");
cel1=sc.nextInt();
System.out.println("Enter Celsuis ending number : ");
cel2=sc.nextInt();
System.out.println("Enter Increment value : ");
int n=sc.nextInt();
System.out.println("Celsius Value Fahrenheit Value");
for(i=cel1;i<cel2;i=i+n)
{
degree_fahrenheit=(double)(9/5)*i+(double)32
System.out.println((double)i+" "+degree_fahrenheit);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.