Question

Selection control structure The if statement The switch statement (optional) Relational operators and logical operators Use...

  • Selection control structure
    • The if statement
    • The switch statement (optional)
  • Relational operators and logical operators
    • Use of relational and logical operators to check numeric ranges
  • User friendly
    • Use of user friendly user prompt and simple input validation
    • Use of meaningful output labels and format
    • Use of output manipulators
  • Working with string type
  • Use of getline()

Project Description

There are two main systems for measuring distance, weight and temperature, the Imperial System of Measurement and the Metric System of Measurement. Most countries use the Metric System, which uses the measuring units such as meters and grams and adds prefixes like kilo, milli and centi to count orders of magnitude. In the United States, we use the older Imperial system, where things are measured in feet, inches and pounds.

Write a 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 use 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.

Project Specifications

Input for this project:

  • the user must enter an number to select a menu option
  • the user must enter temperature in Celsius
  • the user must enter distance in Kilometer
  • the user must enter weight in Kilogram
  • the user must enter a country name

Input Validation:

  • Do not accept a number outside the range of 1 through 4 for the menu option. Be sure to display appropriate error message if the input is invalid.
  • Do not accept negative numbers for distance and weight. Be sure to display appropriate error message if the input is invalid.

Output: The program should display the following:

  • a menu for Converter Toolkit
  • temperature in Fahrenheit, distance in miles or weight in pounds
  • a country name
  • Programmer’s full name
  • project number
  • a due date

Processing Requirements

  1. The program should use at least one selection control structure (if – else statement)
  2. Be sure to convert as specified. For example, convert temperature from Celsius to Fahrenheit, not the other way around.
  3. 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).

Plz give the code and flow chart, thank you so much!!!

Homework Answers

Answer #1

Flow chart:

Source code ( C++):

#include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
void main()
{
   int choice;
   float c,d,k,m,f,p;//c-temperature in celcius,d-distance in kilometer,k-weight in kilogram,m-distance in miles,f-temperature in fahrenheit

   do //loop to make the program a menudriven program
   {
       cout<<"\nChoose the option from the given below\n";//choice dispaly
       cout<<"1. Temperature Converter\n";
       cout<<"2. Distance Converter\n";
       cout<<"3. Weight Converter\n";
       cout<<"4. Quit\n";
       cin>>choice;
       switch(choice)
       {
       case 1: //to convert temperature in fahrenheit
           cout<<"\nEnter the temperature in celcius\n";
           cin>>c;
           f=((9.0/5)*c)+32;
           cout<<"\nTemperature in fahrenheit is "<<f;
           break;
       case 2: //to convert distance in miles
           cout<<"\nEnter the distance in kilometers\n";
           cin>>d;
           m=d*0.6;
           cout<<"\nDistance in mile is "<<m;
           break;
       case 3: // to convert weight in pound
           cout<<"\nEnter the weight in kilogram\n";
           cin>>k;
           p=k*2.2;
           cout<<"\nWeight in pounds is "<<p;
           break;
       case 4: // to quit
           break;
       default : // for wrong input
           cout<<"\nEntered a wrong choice";
       }
   }while(choice!=4);
}

Know the answer?
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
Similar Questions
: YOU MUST USE SWITCH STATEMENTS TO SOLVE THE NEXT TWO PROBLEMS DO NOT USE LOOPS!...
: YOU MUST USE SWITCH STATEMENTS TO SOLVE THE NEXT TWO PROBLEMS DO NOT USE LOOPS! For this problem you must run the program to show all of your menu options working, just like with Problem 1, you will have a screen shot for every menu option and then you will have a screen shot for entering a value that is not part of the menu option. Write a program that displays the following menu to the user: Welcome to...
Write a program display the following menu: Ohms Law Calculator 1. Calculate Resistance in Ohms 2....
Write a program display the following menu: Ohms Law Calculator 1. Calculate Resistance in Ohms 2. Calculate Current in Amps 3. Calculate Voltage in volts 4. Quit Enter your choice (1-4) If the user enters 1, the program should ask for voltage in Volts and the current in Amps. Use the following formula: R= E/i Where: E= voltage in volts I= current in amps R= resistance in ohms If the user enters 2 the program should ask for the voltage...
In c++ format please Most people know that the average human body temperature is 98.6 Fahrenheit...
In c++ format please Most people know that the average human body temperature is 98.6 Fahrenheit (F). However, body temperatures can reach extreme levels, at which point the person will likely become unconscious (or worse). Those extremes are below 86 F and above 106 F. Write a program that asks the user for a body temperature in Fahrenheit (decimals are ok). Check if that temperature is in the danger zone (for unconsciousness) or not and produce the relevant output shown...
Data Encryption (Strings and Bitwise Operators) Write a C program that uses bitwise operators (e.g. bitwise...
Data Encryption (Strings and Bitwise Operators) Write a C program that uses bitwise operators (e.g. bitwise XOR) to encrypt/decrypt a message. The program will prompt the user to select one of the following menu options: 1. Enter and encrypt a message 2. View encrypted message 3. Decrypt and view the message (NOTE: password protected) 4. Exit If the user selects option 1, he/she will be prompted to enter a message (a string up to 50 characters long). The program will...
C++ Fahrenheit to Celsius Tables Write a program that first asks the user which Temperature scale...
C++ Fahrenheit to Celsius Tables Write a program that first asks the user which Temperature scale conversion he/she would like to perform: 1. Convert F to C 2. Convert C to F 3. Quit What is your choice? Then it asks the user for input for three real number variables: start_temp, end_temp, temp_incr. It will then produce a two column Fahrenheit to Celsius table or a two column Celsius to Fahrenheit table, depending on the choice. For choice 1, the...
Objective: Write a Java program that will use a JComboBox from which the user will select...
Objective: Write a Java program that will use a JComboBox from which the user will select to convert a temperature from either Celsius to Fahrenheit, or Fahrenheit to Celsius. The user will enter a temperature in a text field from which the conversion calculation will be made. The converted temperature will be displayed in an uneditable text field with an appropriate label. Specifications Structure your file name and class name on the following pattern: The first three letters of your...
Using Python, write the following code. You are to allow the user to enter the daily...
Using Python, write the following code. You are to allow the user to enter the daily temperature as a floating-point number. You should make the assumption that you are recording temperatures in Fahrenheit. You should allow the user to continue entering temperatures until the value -999 is entered. This number should not be considered a temperature, but just a flag to stop the program. As the user enters a temperature, you should display the following each time: Current Temperature: 999...
For this assignment, you will be creating a simple “Magic Number” program. When your program starts,...
For this assignment, you will be creating a simple “Magic Number” program. When your program starts, it will present a welcome screen. You will ask the user for their first name and what class they are using the program for (remember that this is a string that has spaces in it), then you will print the following message: NAME, welcome to your Magic Number program. I hope it helps you with your CSCI 1410 class! Note that "NAME" and "CSCI...
Create a program that the simulates a thermometer and displays its temperature using different units. 1-...
Create a program that the simulates a thermometer and displays its temperature using different units. 1- Temperature Interface (Temperature.java) This interface should declare the following two abstract methods: • getTemperature      o Returns a String o Accepts no arguments • setTemperature      o Returns void o Accepts one double argument 2- Abstract Thermometer Class (Thermometer.java) This abstract class must implement the Temperature interface and contain: • One private field (a double) named degrees • One constructor that accepts a double...
Problem 1 (Defining products and Creating a Menu) Write a program called a2_p1.py that asks a...
Problem 1 (Defining products and Creating a Menu) Write a program called a2_p1.py that asks a shop owner for product information and creates a menu system that allows customers to purchase multiple products of varying quantities. The program should start by asking the shop owner’s name (string) and company name (string). Next it should ask for three (3) products (strings), their prices (int – not ideal, but for now we will keep it this way), and the number of products...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT