Question
Write C++ code for: A process to allow user to convert from English units to metric units. The user should be prompted to choose what
Write C++ code for:
A process to allow user to convert from English units to metric units. The user should be prompted to choose what type of conversion he/she would like to convert: inches to centimeters, quarts to liters, pounds to kilograms, miles to kilometers, or ounces to grams. The user should be able to choose the conversion by entering a number or a letter. Then the user should be asked to enter the value to be converted. When the user enters a value less than zero for the original measurement, tell him/her that the input is invalid as ask user to enter the value again. Assume the user will not enter an incorrect value more than once.
Prompt the user to enter an I for the conversion from inches to centimeters, a Q for the conversion of quarts to liters, a P for pounds to kilograms, an M for miles to kilometers, or an O for ounces to grams. Use a simple-if (single-branched if) to check the users input and when it is wrong output a message, prompt the user to re-enter the choice, and store the new value. Use a multiway branch to ask the user to enter the value for conversion, and calculate the metric equivalent. Use simple ifs (single-branched ifs) to confirm the entered value to be converted is valid (you do not have to check it is a number). Remember that for now you should assume the user will not enter an incorrect value twice. The message for the invalid input of value to be converted should be something like The number of quarts cannot be negative. Please re-enter the number of quarts to be converted to liters
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