Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program this using basic C++. USE ACTUAL PROGRAMMING Problem 3. Write a process to allow user to convert from English units to metric units. The

Program this using basic C++. USE ACTUAL PROGRAMMING

Problem 3. Write 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

Make sure that you have included your introductory comments containing the purpose of the program i.e. what problem or task is being solved plus the input needed from user to complete the problem/task, output expected from the program, and the processing needed to get the output from the input. The processing should not include any C++ commands. An example of introductory comments for calculating the volume of a sphere is given below These introductory comments should be at the very beginning of the program before any other code (# include and using namespace std;). Your introductory comments should also include your name and section number.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Which personal relationships influenced you the most?

Answered: 1 week ago