Question

Write a C++ program that shows the following menu options and lets the user to convert...

Write a C++ program that shows the following menu options and lets the user to convert from Metric to Imperial system:

Converter Toolkit

--------------------

    1. Temperature Converter

    2. Distance Converter

    3. Weight Converter

    4. Quit

  • If the user enters 1, the program should ask for the temperature in Celsius and convert it to Fahrenheit

  • If the user enters 2, the program should ask for the distance in Kilometer and convert it to Mile

  • If the user enters 3, the program should ask for the weight in Kilogram and convert it to Pound

  • If the user enters 4, the program should end.

Processing Requirements

  1. The program should use at least one selection control structure (if – else statement)

  1. Be sure to convert as specified. For example, convert temperature from Celsius to Fahrenheit, not the other way around.

  1. Use the following for converting input:

  • 1 kilometer = 0.6 mile,

  • 1 kilogram = 2.2 pounds,  

  • The formula for converting Celsius degree to Fahrenheit is:

F = (9/5)*C + 32 where F is the temperature in Fahrenheit and C is the temperature in Celsius

  1. Convert temperature to a whole number such as 78, distance to two positions after decimal point (for example 84.56) and weight to one position after decimal point (For example 121.6).   

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the code for your problem.

#include <bits/stdc++.h>

using namespace std;

int main()

{

    // displaying the menu

    cout << "Converter Toolkit" << endl;

    cout << "\t1. Temperature Converter" << endl;

    cout << "\t2. Distance Converter" << endl;

    cout << "\t3. Weight Converter" << endl;

    cout << "\t4. Exit" << endl;

    cout << "Enter Your Choice:\t" << endl;

    // Taking input from the users

    int choice;

    cin >> choice;

    // if else statement

    if (choice == 1)

    {

        // Using formulas to convert celcius into fahrenheit and then displaying them.

        double celcius, fahrenheit;

        cout << endl

             << "Enter Temperature in celcius:\t";

        cin >> celcius;

        fahrenheit = 9.0 / 5.0 * celcius + 32;

        cout << "Temperature in Fahrenheit:\t" << fahrenheit << endl;

    }

    else if (choice == 2)

    {

        // Using formulas to convert kilometer into miles and then displaying them.

        double kilometer, miles;

        cout << endl

             << "Enter Distance in kilometer:\t";

        cin >> kilometer;

        miles = 0.6 * kilometer;

        cout << "Distance in miles:\t" << miles << endl;

    }

    else if (choice == 3)

    {

        // Using formulas to convert kilograms into pounds and then displaying them.

        double kilograms, pounds;

        cout << endl

             << "Enter Weight in kilograms:\t";

        cin >> kilograms;

        pounds = 2.2 * kilograms;

        cout << "Weights in Pounds:\t" << pounds << endl;

    }

    return 0;

}

Here is the screenshot of the code if the indentation is not clear.

Here is the output of the code.


Hope this helps.

Please rate the answer if you like it.

Do leave a comment.Any suggestion/query is much appreciated.

Add a comment
Know the answer?
Add Answer to:
Write a C++ program that shows the following menu options and lets the user to convert...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You want to write a converter program which will let user convert distance and weight from SI to ...

    Use functions to complete this C + + program You want to write a converter program which will let user convert distance and weight from SI to the USCS system and vice versa The formulae are as follows: 1. Distance in miles- distance in kilometers x 1.60 2. Weight in kilograms weight in pounds x 2.20 The program would let user input the number that they want to convert and then choose the units to and from which they want...

  • Write python program using IDLE Write a full program that asks the user to enter his/her...

    Write python program using IDLE Write a full program that asks the user to enter his/her name then repeatedly ask to enter the temperature in Fahrenheit and convert it to Celsius, the program should then prompt the user if he/she wants to continue or exit the program. The formula for the conversion is: °C = (°F - 32) x 5/9 The program should use a function for the conversion. An Example of a sample run should appear on the screen...

  • Write a single C++ program that performs the following conversion (The modulus divide will help you...

    Write a single C++ program that performs the following conversion (The modulus divide will help you get the remainder as shown in class) 39 / 12 = 3 and 39 % 12 = 3, so 3 feet 3 inch(es) Height conversion 1 meter = 39 inches 12 inches = 1 foot Ask/Prompt the user to enter in the height in meters, convert and output the result in feet and inches Example 1 meters as input should produce 3 feet (foot)...

  • write in python idle Write full program that asks the user to enter his/her name then...

    write in python idle Write full program that asks the user to enter his/her name then repeatedly ask to enter the temperature in Fahrenheit and convert it to Celsius, the program should then prompt the user if he/she wants to continue or exit the program. The formula for conversion is: °C = (°F - 32) x 5/9 The program should use a function for the conversion. An Example of a sample run should appear on the screen like the text...

  • Create a menu-driven Java application that solves several math problems. The user will select a number,...

    Create a menu-driven Java application that solves several math problems. The user will select a number, and the program will respond with a necessary data. When the user enters option 5, the program will end. Below is sample output for the program: What would you like me to do? 1. Calculate area of a circle? 2. Convert Fahrenheit temperature to Celsius? 3. Convert miles to kilometer? 4. Convert inches to centimeter? 5. Exit program? Please enter your option: 1 Enter...

  • Programming Exercise 8.3 | Instructions Write a GUI-based program that allows the user to convert temperature...

    Programming Exercise 8.3 | Instructions Write a GUI-based program that allows the user to convert temperature values between degrees Fahrenheit and degrees Celsius. The interface should have labeled entry fields for these two values. breezypythongui.py temperatureconvert... + 1 2 File: temperatureconverter.py 3 Project 8.3 4 Temperature conversion between Fahrenheit and Celsius. 5 Illustrates the use of numeric data fields. 6 • These components should be arranged in a grid where the labels occupy the first row and the corresponding fields...

  • C++ optional exercise. You are going to convert temperatures in this program. You will give the...

    C++ optional exercise. You are going to convert temperatures in this program. You will give the user the choice of converting Fahrenheit to Celsius or Celsius to Fahrenheit. With the correct answer you will also display the number entered. The user should have the option to convert as many temperatures as they want. Use functions and a menu (also a function) and, assume they will convert at least one temperature. When finished upload and submit the zipped project. the formulas...

  • C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have...

    C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have 2 Labels (each one of them assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of them assigned only to Celsius and Fahrenheit), only 1 Convert Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message label which will display the error messages. The application should only allow the user to enter the desired temperature just in one of the TextBoxes...

  • FOR PYTHON Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice...

    FOR PYTHON Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom functionc_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a...

  • Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The...

    Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT