Question: Write a C + + program that shows the following menu: P [ rogram Overview ] T [ emp Conversion ] Q [ uit ]
Write a C program that shows the following menu:
Program Overview Temp Conversion Quit
If you select t or T you should invoke a user define function void convert double double, char to convert all the temperatures between TempMIN and TempMAX entered by the user, from Celsius to Fahrenheit, or vice versa. The user needs to input C or c to convert to Celsius and F or f to convert to Fahrenheit. The following formulas are employed.
F C C F
If you select P or p Your program should invoke a userdefined function, void progDescription void that displays the overall operation of your program by stating the objectives and describing the sequence of specific steps the program executes and how the user respond to the program prompt.
You should use looping control structures in your program to compute the voltage values and Switch statements to determine the type of output. You will need to use the for input and output displays, and libraries to format the output statements. You can also use to access OS commands.
If the user selects q or Q then your program should terminate.
Algorithm Pseudocode
AlgorithmPseudocode:
Start Program
Include necessary libraries:
Display Main Menu
Display the following options:
Program Overview Temp Conversion Quit
Prompt the user to select an option P T or Q
User Input Menu Option
Read the user's input choice
Use a switch statement to handle different cases for the input:
If the user selects P or p:
Call the function progDescription
If the user selects T or t:
Call the function convertdouble TempMIN, double TempMAX, char type
If the user selects Q or q:
Exit the program.
Program Overview progDescription Function
Function Definition: void progDescription
Display:
Program objectives
Explain that the user can convert temperatures between Celsius and Fahrenheit.
Explain how to navigate the menu and use conversion options.
Return to the main menu after displaying the description.
Temperature Conversion convert Function
Function Definition: void convertdouble TempMIN, double TempMAX, char type
Get User Input:
Prompt the user to enter TempMIN and TempMAX values.
Prompt the user to enter the conversion type C or F
Convert Based on Type:
If type is C or c:
Convert the temperature from Fahrenheit to Celsius for all values between TempMIN and TempMAX using the formula:
C F
If type is F or f:
Convert the temperature from Celsius to Fahrenheit for all values between TempMIN and TempMAX using the formula:
F C
Display Results:
Use looping for loop to iterate over all temperature values between TempMIN and TempMAX.
For each value, display the converted temperature, formatted with two decimal places using
Return to the main menu after conversion.
Quit Program
If the user selects Q or q terminate the program.
Loop Menu Until Quit
Use a dowhile loop to continuously show the menu until the user selects Q or q
End Program
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
