Write a program that displays a table of the Celsius temperatures 0 thru 20 and their Fahrenheit equivalents. The formula for converting a temperature from
Write a program that displays a table of the Celsius temperatures 0 thru 20 and their Fahrenheit equivalents. The formula for converting a temperature from Celsius to Fahrenheit is: F = 9/5C + 32 Where F is the Fahrenheit temperature and C is the Celsius temperature. Your program must use a for loop to display the table. Hint 1: Use doubles (not ints) so the calculation is evaluated correctly (remember dividing an int by an int yields an int, which is not what we want). Hint 2: Use Math.round (which returns a long not an int) to display only the whole number. Example: Math.round(10.2) returns 10 Sample Output:
Centigrade ------------ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Fahrenheit ----------- 32 34 36 37 39 41 43 45 46 48 50 52 54 55 57 59 61 63 64 66 68 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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