Question: 1. Ask the user to input a low temperature and high temperature in Celsius. Use these values to control the loop and display in table
1. Ask the user to input a low temperature and high temperature in Celsius. Use these values to control the loop and display in table format the Celsius and Fahrenheit values between the two inputs. 2. Ask the user to input a low temperature and high temperature in Fahrenheit. Use these values to control the loop and display in table format the Fahrenheit and Celsius values between the two inputs. The following is the program that they need to be added to:
public class CelToFahr{
public static void main(String[] args){ //Declare Valriables int i = 0;
System.out.println("Celsius | Fahrenheit"); System.out.println("--------+-----------");
for ( i = 0; i <= 100; i+= 10) { System.out.print(" " + i + " |");
// formula for celsius to fahrenheit conversion double sum = (i * (9.0/5.0)) + 32; System.out.printf("%5d", (int)sum ); System.out.println(); } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
