Question
C++ = and add comments Specifications for your main function Note: You will not have any other functions other than your main function in this
C++ = and add comments
- Specifications for your main function
Note: You will not have any other functions other than your main function in this program. Do NOT create any programmer-defined functions. You will get to practice creating your own functions in future programming and lab assignments.
- The DO-WHILE LOOP
In order for your program to run multiple times until the user selects to end the program, you will need a do-while loop in the main function. The do part of the loop should be located before the main menu and should end after the switch statement.
- The MAIN MENU
Your MAIN MENU should look like mine (below). Display the menu. Then, as the user to choose 1-4. Then, read in their choice. Then, validate their choice with a WHILE LOOP. If they entered something other than a 1-4 then your while loop should force the user to enter in a valid choice.
--MAIN MENU--
What would you like to look at?
1. Oven Temperatures & Conversions
2. View Solids Measurements
3. Liquids Measurements & Conversions
4. End the Program
CHOOSE 1-4:
- The SWITCH STATEMENT
Based on what the user selected, use a switch statement to execute the appropriate code based on their choice. If the user selected #1, then your program will execute the statements described in section 4.3 Converting Temperatures of this document. If the user selects #2, then the program will execute the statements described in section 4.4 Viewing Solid Measurements of this document. If the user selects #3 then the program will execute the statements described in section 4.5 Converting Liquids of this document. If the user chose #4 then the switch statement will end and the do-while loop will end. Your program should lastly print out a message before the program ends like the sample output below, indicating how many calculations were performed (adding all calculations performed when the user selected 1 or 3 in the main menu).
--MAIN MENU--
What would you like to look at?
1. Oven Temperatures & Conversions
2. View Solids Measurements
3. Liquids Measurements & Conversions
4. End the Program
CHOOSE 1-4: 4
Thank you for using the measurement program.
Hopefully you can cook something really special for me
because you made 6 conversions!
- Converting Temperatures
Use the steps and sample output below to figure out what should happen in this part of the program.
- Use a do-while loop to run the content in this section until the user selects to go back to the MAIN MENU.
- Display the OVEN TEMBERATURES menu, which includes information about boiling and freezing water.
- Read in the users choice & validate the users choice with a WHILE LOOP
- Use either a switch statement or if-else if statement to do the proper conversions.
- Your calculations must be correct and output should be limited to 2 places after the decimal point.
- Each time you do a conversion you should increment the number of conversions performed in the program.
- Refer to sample output below to see this section of the code executing. All values highlighted in yellow is input from the user.
--MAIN MENU--
What would you like to look at?
1. Oven Temperatures & Conversions
2. View Solids Measurements
3. Liquids Measurements & Conversions
4. End the Program
CHOOSE 1-4: 3
--LIQUIDS MEASUREMENTS--
What measurement do you know?
1. I know how many gallons I have.
2. I know how many quarts I have.
3. I know how many pints I have.
4. I know how many cups I have.
5. Go back to MAIN MENU.
CHOOSE 1-5: 1
How many gallons do you have?
3.4
RESULT: 3.40 gallons is 13.60 quarts, 27.20 pints, or 54.40 cups.
--LIQUIDS MEASUREMENTS--
What measurement do you know?
1. I know how many gallons I have.
2. I know how many quarts I have.
3. I know how many pints I have.
4. I know how many cups I have.
5. Go back to MAIN MENU.
CHOOSE 1-5: 2
How many quarts do you have?
4.8
RESULT: 4.80 quarts is 1.20 gallons, 9.60 pints, or 19.20 cups.
--LIQUIDS MEASUREMENTS--
What measurement do you know?
1. I know how many gallons I have.
2. I know how many quarts I have.
3. I know how many pints I have.
4. I know how many cups I have.
5. Go back to MAIN MENU.
CHOOSE 1-5: 3
How many pints do you have?
8.3
RESULT: 8.30 pints is 1.04 gallons, 4.15 quarts, or 16.60 cups.
--LIQUIDS MEASUREMENTS--
What measurement do you know?
1. I know how many gallons I have.
2. I know how many quarts I have.
3. I know how many pints I have.
4. I know how many cups I have.
5. Go back to MAIN MENU.
CHOOSE 1-5: 4
How many cups do you have?
14.2
RESULT: 14.20 cups is 0.89 gallons, 3.55 quarts, & 7.10 pints.
--LIQUIDS MEASUREMENTS--
What measurement do you know?
1. I know how many gallons I have.
2. I know how many quarts I have.
3. I know how many pints I have.
4. I know how many cups I have.
5. Go back to MAIN MENU.
CHOOSE 1-5: 5
--MAIN MENU--
What would you like to look at?
1. Oven Temperatures & Conversions
2. View Solids Measurements
3. Liquids Measurements & Conversions
4. End the Program
CHOOSE 1-4: 4
Thank you for using the measurement program.
Hopefully you can cook something really special for me
because you made 6 conversions!
Thats How the end result should be.
--SOLIDS MEASUREMENTS--
What do you want to do?
1. View a chart for butter.
2. View a chart for Dry Goods such as flower & sugar.
3. Go back to MAIN MENU.
CHOOSE 1-3: 1
BUTTER
CUPS GRAMS
1/4 cup of Butter 57 grams
1/3 cup of Butter 76 grams
1/2 cup of Butter 113 grams
1 cup of Butter 227 grams
--SOLIDS MEASUREMENTS--
What do you want to do?
1. View a chart for butter.
2. View a chart for Dry Goods such as flower & sugar.
3. Go back to MAIN MENU.
CHOOSE 1-3: 2
DRY GOODS (FLOUR & SUGAR)
1/8 cup 16 grams .563 ounces
1/4 cup 32 grams 1.13 ounces
1/3 cup 43 grams 1.5 ounces
1/2 cup 64 grams 2.25 ounces
2/3 cup 85 grams 3 ounces
3/4 cup 96 grams 3.38 ounces
1 cup 128 grams 4.5 ounces
--SOLIDS MEASUREMENTS--
What do you want to do?
1. View a chart for butter.
2. View a chart for Dry Goods such as flower & sugar.
3. Go back to MAIN MENU.
CHOOSE 1-3: 3
--MAIN MENU--
What would you like to look at?
1. Oven Temperatures & Conversions
2. View Solids Measurements
3. Liquids Measurements & Conversions
4. End the Program
CHOOSE 1-4:
also
--MAIN MENU--
What would you like to look at?
1. Oven Temperatures & Conversions
2. View Solids Measurements
3. Liquids Measurements & Conversions
4. End the Program
CHOOSE 1-4: 1
--OVEN TEMPERATURES--
Water boils at 100 degrees Celsius and 212 degrees Fahrenheit.
Water freezes at 0 degrees Celsius and 32 degrees Fahrenheit.
What do you want to do?
1. Convert a temperature from Celsius to Fahrenheit.
2. Convert a temperature from Fahrenheit to Celsius.
3. Go back to MAIN MENU.
CHOOSE 1-3: 1
What is the temperature in Celsius?
85.6
RESULT: 85.60 degrees Celsius is 186.08 degrees Fahrenheit.
--OVEN TEMPERATURES--
Water boils at 100 degrees Celsius and 212 degrees Fahrenheit.
Water freezes at 0 degrees Celsius and 32 degrees Fahrenheit.
What do you want to do?
1. Convert a temperature from Celsius to Fahrenheit.
2. Convert a temperature from Fahrenheit to Celsius.
3. Go back to MAIN MENU.
CHOOSE 1-3: 2
What is the temperature in Fahrenheit?
96.4
RESULT: 96.40 degrees Fahrenheit is 35.78 degrees Celsius.
--OVEN TEMPERATURES--
Water boils at 100 degrees Celsius and 212 degrees Fahrenheit.
Water freezes at 0 degrees Celsius and 32 degrees Fahrenheit.
What do you want to do?
1. Convert a temperature from Celsius to Fahrenheit.
2. Convert a temperature from Fahrenheit to Celsius.
3. Go back to MAIN MENU.
CHOOSE 1-3: 3
--MAIN MENU--
What would you like to look at?
1. Oven Temperatures & Conversions
2. View Solids Measurements
3. Liquids Measurements & Conversions
4. End the Program
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