Question: This program will combine the functionality of the previous 2 programs. It will: Ask the user if he or she wants to convert from feet
This program will combine the functionality of the previous programs. It will:
Ask the user if he or she wants to convert from feet and inches to meters or from meters to feet and inches.
The user responds by entering to convert from feet and inches or to convert from meters.
Your program will read the users selection and then execute an if else statement to where each branch will contain a call to an appropriate function which will then drive the rest of the application based on that selection.
You must use the following definition of main. The only modification to main should be the addition of the code to insure the user enters either or for the choice of conversion. You will build the rest of your program using the functions that you created in problems and
int main
char ans; loop control variable
int which; stores the choice of conversion
do
Add a loop here to insure that the user enters either or
cout
Enter for English to Metric or endl
"Enter for Metric to English conversion"
endl;
cin which;
if which
ConvertToMetric;calls the ConvertToMetric functions
else
ConvertToEnglish;calss the ConvertToEnglish functions
cout Y or y allows another choice of conversion.
"any other quits" endl;
cin ans;
while y ans Y ans;
return ;
Test with the following data:
feet inches
meters
Your test run should mirror the test run on the next page.
Test Run
Enter for English to Metric or
Enter for Metric to English conversion
Enter feet as an integer:
Enter inches as a double:
Invalid data please reenter
Enter feet as an integer:
Enter inches as a double:
meters corresponds to feet, inches
Y or y allows another choice of conversion. any other quits
y
Enter for English to Metric or
Enter for Metric to English conversion
Enter feet as an integer:
Enter inches as a double:
meters corresponds to feet, inches
Y or y allows another choice of conversion. any other quits
y
Enter for English to Metric or
Enter for Metric to English conversion
Enter a number of meters as a double
Invalid data please reenter
Enter a number of meters as a double
meters corresponds to feet, inches
Y or y allows another choice of conversion. any other quits
y
Enter for English to Metric or
Enter for Metric to English conversion
Enter a number of meters as a double
meters corresponds to feet, inches
Y or y allows another choice of conversion. any other quits
n
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
