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:
Convert Fahrenheit to Celsius
Convert Celsius to Fahrenheit
Convert Fahrenheit to Kelvin
Display Data
Quit Program
Enter your selection :
Additional details:
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.
Write a return method named showMenu that displays the menu. This method
should not accept any arguments but should return a valid selection value
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.
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.
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 to using the following formula:
i CF
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 to using the following formula:
i
Write a return method named calcKelvin, which accepts the Fahrenheit
temperature as an argument. Convert degrees to using the following
formula:
i
ii or
iii.
Create a void method named displayData which receives three
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.
For every value entered, all three temperatures should be calculated
Fahrenheit, Celsius, and Kelvin.
The program should continue to execute until the user enters to quit the
program.
The program should accept both positive and negative temperatures.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
