Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Your family is going on an international trip. You will go to regions where meas

ID: 3756420 • Letter: Y

Question

Your family is going on an international trip. You will go to regions where measurement units used are different from home. Your mom is very worry about the difficulty of the conversion. You decide to help her with a converter toolkit. Write a program that converts temperature, distance, and weight and displays the following menu 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 then convert it to temperature in Fahrenheit If the user enters 2, the program should ask for the .If the user enters 3, the program should ask for the .If the user enters 4, the program should end distance in Kilometer and convert it to distance in Mile weight in Kilogram and convert it to distance in Pound Project Specifications Input for this project the user must enter integer as a choice for the menu 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 when the user enters a number selecting an item from the menu. Be sure to display appropriate error messages for these items 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

Explanation / Answer

#include<iostream>
#include<iomanip> // To manipulate the output, setprecision()
#include<process.h>
using namespace std;
int main()
{
   int ch;
    float var;
   char name[30];
   cout<<"Enter a country name: ";
   cin>> name;
  
   cout<<" Converter Toolkit"<<endl;;
   cout<<"------------------"<<endl;
   cout<<"1. Temperature Converter"<<endl;
   cout<<"2. Distance Converter"<<endl;
   cout<<"3. Weight Converter"<<endl;
   cout<<"4. Quit"<<endl;
   cout<<"Enter your choice (1-4): ";
   cin>>ch;
  
   switch(ch)     //selective control
   {
       case 1:
           cout<<"Please enter temperature in Celsius: ";
           cin>>var;
           if(var<0||var>100)    //logical operator used and also relational oprator
           cout<<"Temperature cannot be in "<<var<<" Celsius.";
           else
           cout<<"It is "<< int(var*1.8+32)<<" Fahrenheit."; //Typecasting the temperatiure
           break;
          
       case 2:
             cout<<"Please enter distance in Kilometer: ";
           cin>>var;
           if(var<0)
           cout<<"!!!Distance cannot be negative!!!";
           else
           {
           cout.setf(ios::fixed);
           cout<<"It is "<<setprecision(2)<<var* 0.6 <<" Miles.";
             }
           break;
  
       case 3:
             cout<<"Please enter weight in Kilogram: ";
           cin>>var;
           if(var<0)
           cout<<"!!!Weight cannot be negative!!!";
           else
           cout<<"It is "<<setprecision(1)<<var*2.2 <<" Pounds.";
           break;     
  
       case 4:
             exit(0);  
  
       default:
             cout<<"Enter a valid input";   
   }
  
   cout<<" "<<name<<" sounds fun"<<endl<<" ";
   cout<<"PROGRAMMER: XYZ"<<endl;   //Programmer's name
   cout<<"PROJECT X"<<endl;         //Project Number
   cout<<"9/24/2018"<<endl;         //Duedate
  
   cout<<"Thank You for testing my program";
    return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote