Write a program in Java Celsius to Fahrenheit Table This project provides an opp
ID: 3593885 • Letter: W
Question
Write a program in Java
Celsius to Fahrenheit Table This project provides an opportunity to explore application versioning. In a previous assignment you had to write a program to convert a Celsius temperature in to a Fahrenheit temperature. You will now go back and provide maintenance on that program by adding modifying the features and functionality of that program In the next version of the program, write a program to print a Celsius to Fahrenheit conversion table that a traveler could use to look up temperatures while traveling. Once again, the formula is F (9/5 * C) +32 The program should once again input the name of the city where the temperature conversion will take place. The program should input a starting temperature in Celsius. From the starting temperature, the program should produce a table of 40 temperature conversions from Celsius to Fahrenheit. The table should include integer Celsius degrees from the starting temperature to an ending temperature 40 degrees from the starting temperature. You program does not need to use integers, it can use floating point values, but the table should display the Celsius temperature, then the associated Fahrenheit temperature, accurate to one-tenth of a degree. The example below shows the first five entries from a table if the user entered O as the starting Celsius value Remember this is a Celsius to Fahrenheit Table not a Fahrenheit to Celsius conversion The starting point in the table is the value entered by user The examples are shown below: Celsius Fahrenheit 0 32.0 33.8 35.6 37.4 39.2 41.0 2 3 4 This is a 30 Point Assignment The starting point in the table is the value entered by userExplanation / Answer
import java.io.*;
import java.util.*;
import java.text.*;
public class DemoTemp{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the starting value :");
int n = sc.nextInt();
System.out.println("Celsius Fahrenheit");
for (int i = n; i<40; i++){
double d = (double)((9.0/5.0) * i) + 32.0;
DecimalFormat f = new DecimalFormat("##.0");
System.out.println(i + " " + f.format(d));
}
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.