Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions