Question
Create a program in Java that converts Celsius to Fahrenheit and Fahrenheit to Celsius and displays as a table on the console as shown in
Create a program in Java that converts Celsius to Fahrenheit and Fahrenheit to Celsius and displays as a table on the console as shown in the sample output below. Remember to use proper naming convention for variables. Please do not include arrays and return. Define 2 value-returning methods & use the following formulas: Calculate Celsius to Fahrenheit. Fahrenheit = Celsius * 9/5 + 32 Calculate Fahrenheit to Celsius. Celsius = (Fahrenheit - 32) * 5/9; Using a loop (while loop, do/while loop, or for loop), display 20 lines of results incremented as shown in the sample output below. Required: Format columns one and three to 1 decimal place. Format columns two and four to 2 decimal places. See sample output
The program should be very similar to this sample output:
Celsius Fahrenheit | Fahrenheit Celsius ---------------------------------------- 0.0 32.00 | 32.0 0.00 2.5 36.50 | 37.0 2.78 5.0 41.00 | 42.0 5.56 7.5 45.50 | 47.0 8.33 10.0 50.00 | 52.0 11.11 12.5 54.50 | 57.0 13.89 15.0 59.00 | 62.0 16.67 17.5 63.50 | 67.0 19.44 20.0 68.00 | 72.0 22.22 22.5 72.50 | 77.0 25.00 25.0 77.00 | 82.0 27.78 27.5 81.50 | 87.0 30.56 30.0 86.00 | 92.0 33.33 32.5 90.50 | 97.0 36.11 35.0 95.00 | 102.0 38.89 37.5 99.50 | 107.0 41.67 40.0 104.00 | 112.0 44.44 42.5 108.50 | 117.0 47.22 45.0 113.00 | 122.0 50.00 47.5 117.50 | 127.0 52.78 50.0 122.00 | 132.0 55.56
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started