Question

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 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;...

This is only a preview of the solution. Please use the purchase button to see the entire solution

$30.00

or $1 if you
register a new account!

Related Homework Solutions

C#: ShoppingCart App
Homework Solution
$40.00
Visual
C#
Computer
Science
Shopping
Cart
Fill
Console
Application
How to Program
Pythagoras
Triples
Matrix Multiplication
Homework Solution
$23.00
Matrix
Multiplication
Computer
Science
C-Family
Programming
Print
Results
Input
Output
Values
Label
Number Conversion to Any Base
Homework Solution
$18.00
Base Conversion
Hexadecimal
Any Base
Convert
Number
Computer Science
C-Family Programming
Programming Problem: Skyline Buildings
Homework Solution
$8.00
Programming
C++
Skyline Buildings
Computer Science
Codes
XOR
Advertisement
Algorithms
Implementations
Languages
Classes
Area
Maximum Values
Corresponding Elements
Constraints
Statements
Variables
C Code Errors Minireport
Homework Solution
$25.00
Error
C
Code
Message
Compiler
Common
Friendly
Computer Science
C-Family Programming
Get help from a qualified tutor
Live Chats