Question

In: Computer Science

write c++ program. 1. Time converter 2. Length Converter 3. weight Converter 4.Currency Converter 5. Temprature...

write c++ program.
1. Time converter
2. Length Converter
3. weight Converter
4.Currency Converter
5. Temprature Converter (C to F and F to C)

time converter (minutes to second, second to minutes, hours to seconds, seconds to hours, minutes to hours, hours to minutes)

Solutions

Expert Solution

Code: (Text File Also Included in End)


Output:


Files:


Code:

#include <iostream>
#include<string>
using namespace std;

void print(string msg){ // Method for print simple string
   cout << msg << "\n";
}

void printDouble(double val){ // Method for print a double
   cout << val << "\n";
}

/*
A multiplierMethod which takes multiplier in method call
and takes value input from user and multiplies both and
prints result.
*/
void multiplierMethod(double multiplier){
   double val;
   print("Type value to be Converted");
   cin >> val;
   print("Converted Output:");
   printDouble(val * multiplier);
}

int main() // Main Method
{
   double multiplier; // Variable for store multiplier
   print("*** Universal Converter***");

   while(true){ // Infinite Loop
       // Printing Menu
       print("Choose Menu:");
       print("1: Time Converter");
       print("2: Length Converter");
       print("3: Weight Converter");
       print("4: Currency Converter");
       print("5: Temperature Converter");
       int Menu;
       cin >> Menu; // Taking Menu input
       switch(Menu){ // Switching over input
           case 1: // Time Conversion is choosen
           {   // Printing Sub Menu for Time Conversion
               print("Choose Conversion");
               print("1: Minutes To Second");
               print("2: Second To Minutes");
               print("3: Hours To Second");
               print("4: Second to Hours");
               print("5: Hours to Minutes");
               int time;
               cin >> time; // Time conversion Type
               switch(time){ // Switching over selected input
                   case 1: multiplierMethod(60); break;
                   case 2: multiplierMethod(1.0/60); break;
                   case 3: multiplierMethod(3600); break;
                   case 4: multiplierMethod(1.0/3600); break;
                   case 5: multiplierMethod(60); break;
               }
           }
           break;
           case 2: // Length Conversion is choosen
           { // There can be many cases of length, So insted of
               // providing menu, simply asking multiplier
               print("Type multiplier(Ex. Meter to Cm = 1000):");
               cin >> multiplier;
               multiplierMethod(multiplier);
               break;
           }
           case 3: // Weight Conversion is choosen
           {
               print("Type multiplier(Ex. Kg to g = 1000):");
               cin >> multiplier;
               multiplierMethod(multiplier);
               break;
           }
           case 4: // Currency conversion is choosen
           {
               print("Type multiplier(Ex. Pound to Dollar = 1.30):");
               cin >> multiplier;
               multiplierMethod(multiplier);
               break;
           }
           case 5: // Temperature conversion is choosen
           {
               print("Choose Conversion:");
               print("1: Celcius to Farenheit");
               print("2: Farenheit to Celcius");
               string temp;
               cin >> temp;
               double val;
               print("Type value to be Converted");
               cin >> val;
               print("Converted Output:");
               if (temp == "1"){
                   printDouble((val * 9/5) + 32);
               }else{
                   printDouble((val - 32) * 5/9);
               }
               break;
           }
           default:
           print("Wrong Menu, Choose Again!");
           break;
       }
   }
   return 0;
}


Related Solutions

Write a Python program that has a list of 5 numbers [2, 3, 4, 5, 6)....
Write a Python program that has a list of 5 numbers [2, 3, 4, 5, 6). Print the first 3 elements from the list using slice expression. a. Extend this program in a manner that the elements in the list are changed to (6, 9, 12, 15, 18) that means each element is times 3 of the previous value. b. Extend your program to display the min and max value in the list.
-Write a program in C++: • to find the sum of the series 1! /1+2! /2+3!...
-Write a program in C++: • to find the sum of the series 1! /1+2! /2+3! /3+4! /4+5! /5 using the function1, • to convert decimal number to binary number using the function2, • to check whether a number is a prime number or not using the function3, • to check whether two given strings are an anagram using the function4. important must do in (Multi-Filing) of c++
2. Write a C++ program that; Takes in the weight of a person in Kilograms, converts...
2. Write a C++ program that; Takes in the weight of a person in Kilograms, converts and outputs the equivalent weight in pounds. Format your output to 3 decimal places. Your output should look like this 53.000 Kg is equivalent to 123.459 Ibs (Note 1Kg = 2.2046226218488 lbs) Takes in the price of an item on an online store in pound sterling, converts and outputs the equivalent price in U.S dollars. Format your output to 2 decimal places. Your output...
Direction ratio of line joining (2, 3, 4) and (−1, −2, 1), are: A. (−3, −5, −3) B. (−3, 1, −3) C. (−1, −5, −3) D. (−3, −5, 5)
Direction ratio of line joining (2, 3, 4) and (−1, −2, 1), are:A. (−3, −5, −3)B. (−3, 1, −3)C. (−1, −5, −3)D. (−3, −5, 5)
Problem: Design and write a C language program that can be used as a unit converter...
Problem: Design and write a C language program that can be used as a unit converter application. Your unit converter should contain at least four unit categories, for example: length, mass, temperature, and time. The program should display the main menu that contains unit categories that are available, and the user will be prompted to select a unit category first. After the unit category has been selected the program should then display another menu (i.e., a submenu) that contains at...
a C++ program that reads in weight in pounds and outputs the equivalent length in Kilograms...
a C++ program that reads in weight in pounds and outputs the equivalent length in Kilograms and grams. Use at least three functions: one for input, one or more for calculating, and one for output. Include a loop that lets the user repeat this computation for new input values until the user says he or she wants to end the program. 1 pound (lb) is equal to 0.45359237 kilograms (kg). There are 1000 grams in a kilogram and 16 ounces...
a C++ program that reads in weight in pounds and outputs the equivalent length in Kilograms...
a C++ program that reads in weight in pounds and outputs the equivalent length in Kilograms and grams. Use at least three functions: one for input, one or more for calculating, and one for output. Include a loop that lets the user repeat this computation for new input values until the user says he or she wants to end the program. 1 pound (lb) is equal to 0.45359237 kilograms (kg). There are 1000 grams in a kilogram, and 16 ounces...
Using C Language Write a program segment that computes 1 + 2 + 3 + ......
Using C Language Write a program segment that computes 1 + 2 + 3 + ... + ( n - 1) + n , where n is a data value. Follow the loop body with an if statement that compares this value to (n * (n + 1)) / 2 and displays a message that indicates whether the values are the same or different. Please give me code to just copy and paste
Multiples of 2 and 3: write a c++ program Using a while loop, write a program...
Multiples of 2 and 3: write a c++ program Using a while loop, write a program that reads 10 integer numbers. The program shall count how many of them are multiples of 2, how many are multiples of 3, and how many are NOT multiples of either 2 or 3. The output should be similar to the one shown below.
4. (a) Suppose that τσ=(1 5 2 3)(4) and στ=(1 2 4 5)(3) in S5. If...
4. (a) Suppose that τσ=(1 5 2 3)(4) and στ=(1 2 4 5)(3) in S5. If σ1 = 2, find σ and τ. (b) In Sn, show that σ = τ if and only if σ(τ)^(−1) = ε. ε is the identity permutation. Must be written as a proof. (c) Let σ=(1 2 3) and τ=(1 2) in S3. Show that S3={ε,σ,σ^2,τ,τσ,τ(σ)^2} and that σ^3=ε=τ^2 and στ=τ(σ)^2, then fill out the multiplication table for S3.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT