Question: Description Write a java program that allows the user to convert temperatures to Fahrenheit, Celsius and Kelvin, then displays the values ( do not use

Description
Write a java program that allows the user to convert temperatures to Fahrenheit, Celsius and Kelvin, then displays the values (do not use array's, or private static, or linked lists)
The program is to be menu driven. Validate user input for acceptable values. The
program should display the following menu of selections:
1. Convert Fahrenheit to Celsius
2. Convert Celsius to Fahrenheit
3. Convert Fahrenheit to Kelvin
4. Display Data
5. Quit Program
Enter your selection (1-5):
Additional details:
1. Write a main method to control the program. Within main when one
temperature changes, change all temperatures - Fahrenheit, Celsius and
Kelvin. All the new temperatures should be calculated and stored in a local
array for output. Store each in their own array. Temperature conversions are
only to be done within the methods designed for that purpose. Do not convert
any temperature outside of those conversion methods.
2. Write a return method named showMenu that displays the menu. This method
should not accept any arguments but should return a valid selection value (1-5
. Validation of the input should take place within showMenu. Output an
appropriate error message to the user if the choice is not acceptable, then
redisplay the menu. DO NOT CALL SHOWMENU FROM INSIDE THE
METHOD.
3. Write a return method named getTemperature(). It has one argument, the type
of temperature being requested as a String data type - Fahrenheit, or Celsius.
This text value should be concatenated with the prompt to the user. It should
prompt the user to input a temperature and return that value to the calling
statement. Validate input and output an appropriate error message.
4. Write a return method named calcCelsius, which accepts the Fahrenheit
temperature as an argument. The method should return the converted value to
main for storage. Convert degrees F to C using the following formula:
i. C=(5/9)(F-32)
5. Write a return method named calcFahrenheit, which accepts the Celsius
temperature as an argument. The method should return the converted value to
main for storage. Convert degrees C to F using the following formula:
i.F=(C95)+32
6. Write a return method named calcKelvin, which accepts the Fahrenheit
temperature as an argument. Convert degrees F to K using the following
formula:
i.K=C+273.15
ii. or
iii. K=(59)(F-32)+273.15
7.Create a void method named displayData(), which receives three (3)
arguments - the Fahrenheit, Celsius and Kelvin value arrays. Format output
to two digits passed the decimal point. Trailing zeros should display. All
decimal points should align in the columns of data when output.
8.For every value entered, all three temperatures should be calculated -
Fahrenheit, Celsius, and Kelvin.
9.The program should continue to execute until the user enters 5 to quit the
program.
10. The program should accept both positive and negative temperatures.
11. If the user selects an invalid choice from the menu, the program should
display an appropriate error message and not return to main until a valid
selection is made.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!