QuestionQuestion

Using the Shapes program as an example, create a menu driven program that will do at least 5 metric conversions. You can do inches to centimeters, kilos to pounds, etc. You can use inches to centimeters, kilos to pounds, kilometers to miles, meters to feet and Celsius to Fahrenheit, etc.

Example Shapes program below
//A menu driven program to find area of shapes
#include <iostream>
using namespace std;
//function prototypes
void circle(void); //finds area of circle
void square(void); //finds area of square
void rectangle(void); //finds area of rectangle
void menu(void); //displays choices
void doChoice(char choice); //calls function selected
void main(void) //display menu and call function selected
{ char choice;
do
{ menu(); //display choices
cin>>choice;
doChoice(choice); //calls function selected
} while ((choice != 'Q') && (choice !='q'));
system("pause");
} //main
void doChoice(char choice) //calls function selected
{ switch (choice)
{ case 'C': case 'c': circle(); break;
case 'R': case 'r': rectangle(); break;
case 'S': case 's': square(); break;
} //choice
} //doChoice
void menu(void) //display the choices
{ cout<<"This will find the area of a shape\n\n";
cout<<"Enter the letter of your choice: \n";
cout<<"C: Circle\n";
cout<<"R: Rectangle\n";
cout<<"S: Square\n\n";
cout<<"Q: Quit\n";
cout<<"Please enter your choice:";
} //menu
void circle(void) //find area of circle from radius
{ double radius, area;
cout<<"Enter the radius of the circle:";
cin>>radius;
area = radius*radius*3.14158;
cout<<"The area is "<<area<<"\n\n";
} //circle
void rectangle(void) //find area of rectangle from length and width
{ double length, width, area;
cout<<"Enter the width of the rectangle:";
cin>>width;
cout<<"Enter the length of the rectangle:";
cin>>length;
area = width * length;
cout<<"The area is "<<area<<"\n\n";
} //square
void square(void) //find area of square from side
{ double side, area;
cout<<"Enter the side of the square:";
cin>>side;
area = side * side;
cout<<"The area is "<<area<<"\n\n";
} //square

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <iostream>

double centToInch(double cent);
double kiloToPound(double kilo);
double kilometerToMile(double kilometer);
double metersToFeet(double meters);
double celsiusToFahrenheit(double cels);

using namespace std;

int main()
{
    int choice;
    double measurement;

while(true)
{
cout << "Possible choices: " << endl;
cout << "1. Centimeters to inches" << endl;
cout << "2. Kilograms to Pounds" << endl;
cout << "3. Kilometers to Miles" << endl;
cout << "4. Meters to Feet" << endl;
cout << "5. Celsius to Fahrenheit" << endl;
cout << "6. Exit Program" << endl;
cout << "Choice: ";
cin >> choice;

   switch(choice)
   {
   case 1:
    cout << "Please enter the number of centimeters to convert: ";
    cin >> measurement;
    cout << measurement << " centimeters is equal to " << centToInch(measurement) << " inches" << endl;
    break;
   case 2:
    cout << "Please enter the number of Kilograms to convert: ";
    cin >> measurement;
    cout << measurement << " Kilograms is equal to " << centToInch(measurement) << " Pounds" << endl;
    break;...
$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats