Question

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) 3 inches as output

Ask/Prompt the user to enter in the height in feet and inches, convert and output the result in meters

Weight conversion

1 Kg = 35 ounces

16 ounces = 1 pound

Ask/Prompt the user to enter in the weight in Kg, convert and output the result in pounds and ounces

Example 1 kg as input should produce 2 pounds 3 ounces as output

Ask/Prompt the user to enter in the weight in pounds and ounces, convert and output the result in kg

Currency conversion

1 Dollar = 114400 Jeon

120 Jeon = 1 Won

Ask/Prompt the user to enter in the monetary value in dollars, convert and output the result in won and jeon

Ask/Prompt the user to enter in the monetary value in won and jeon, convert and output the result in dollars

Temperature conversion

Fahrenheit = Celsius * 1.8 + 32

Ask/Prompt the user to enter in the temperature in Celsius, convert and output the result in Fahrenheit

Ask/Prompt the user to enter in the temperature in Fahrenheit, convert and output the result in Celsius

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

PROGRAM

#include<iostream>
using namespace std;
//method for height conversion
void height_conversion()
{
   long int meter,feet,inches;
   //input the height in meters
   cout<<endl<<"Enter the height in meters";
   cin>>meter;
   //convert into inches
   inches= meter * 39;
   //convert into feet
   feet = inches/12;
   //convert into inches
   inches = inches % 12;
   //display the details
   cout<<endl<<meter <<" Meters = "<<feet<<" Feet & "<<inches<<" Inches.";
   //read the height in feet and inches
   cout<<endl<<"Enter the height in feet and inches : ";
   cout<<endl<<" Feet : ";
   cin>>feet;
   cout<<endl<<" Inches :";
   cin>>inches;
   //display the input data
   cout<<endl<<feet<<" Feet & "<<inches<<" Inches = ";
   //convert into inches
   inches = (feet * 12) + inches;
   //convert into meters
   meter = inches/39;
   //display in meters
   cout<<meter<<" Meters.";
}
//method for weight conversion
void weight_conversion()
{
   long int kg,ounces,pound;
   //input the weight in kgs
   cout<<endl<<"Enter the Weight in Kgs.";
   cin>>kg;
   //convert into ounces
   ounces = kg * 35;
   //convert into pound
   pound = ounces/16;
   //convert into ounces
   ounces =ounces % 16;
   //display the details
   cout<<endl<<kg <<" Kgs. = "<<pound<<" Pound & "<<ounces<<" Ounces.";
   //read weight in pound and ounces
   cout<<endl<<"Enter the Weight in Pound and Ounces : ";
   cout<<endl<<" Pound : ";
   cin>>pound;
   cout<<endl<<" Ounces :";
   cin>>ounces;
   //display the input data
   cout<<endl<<pound<<" Pound & "<<ounces<<" Ounces = ";
   //convert into ounces
   ounces = (pound * 16) + ounces;
   //convert into kgs
   kg = ounces/35;
   //display the weight in kgs
   cout<<kg<<" Kgs.";

}
//method for currency conversion
void currency_conversion()
{
   long int dollar,jeon,won;
   //input the currency in dollar
   cout<<endl<<"Enter the Currency in Dollars.";
   cin>>dollar;
   //convert into jeon
   jeon = dollar * 114400;
   //convert into won
   won = jeon / 120;
   //convert into jeon
   jeon =jeon % 120;
   //display the details
   cout<<endl<<dollar <<" Dollars = "<<won<<" Won & "<<jeon<<" Jeon.";
   //read the currency in won and jeon
   cout<<endl<<"Enter the Weight in Won and Jeon : ";
   cout<<endl<<" Won : ";
   cin>>won;
   cout<<endl<<" Jeon :";
   cin>>jeon;
   //display the input data
   cout<<endl<<won<<" Won & "<<jeon<<" Jeon = ";
   //convert to jeon
   jeon = (won * 120) + jeon;
   //convert to dollar
   dollar = jeon/114400;
   //display the currecny in dollar
   cout<<dollar<<" Dollar";
}
//method for temperature conversion
void temperature_conversion()
{
   double f,cel;
   //input the temperature in farenhite
   cout<<endl<<"Enter the temperature in Farenhite";
   cin>>f;
   //convert to celcius
   cel = (f-32)/1.8;
   //display the result
   cout<<endl<<f<<" Farenhite = "<<cel<<" Celcius.";
   //read the temperature in celcius
   cout<<endl<<"Enter the temperature in Celcius";
   cin>>cel;
   //convert to farenhite
   f = cel * 1.8 + 32;
   //display the result
   cout<<cel<<" Celcius = "<<f<<" Farenhite.";
   }
   //driver program
int main()
{
//call to height_conversion()
   height_conversion();
   //call to weight_conversion()
   weight_conversion();
   //call to currency_conversion()
   currency_conversion();
   //call to temperature_conversion()
   temperature_conversion();
}

OUTPUT

Add a comment
Know the answer?
Add Answer to:
Write a single C++ program that performs the following conversion (The modulus divide will help you...
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
  • Write a Java program that performs these operations Prompt the user to enter a low height...

    Write a Java program that performs these operations Prompt the user to enter a low height in feet (an integer) Prompt the user to enter a high height in feet (an integer) Prompt the user to enter a low weight in pounds (an integer) Prompt the user to enter a high weight in pounds (an integer) Print a table of Body Mass Index (BMI) for the heights and weights entered, ranging from the low height to the high height (inclusive),...

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

  • I have this c++ program that i have to create but i am stuck on it....

    I have this c++ program that i have to create but i am stuck on it. Write a height conversion program that shall allow user to convert from feet and inches to meters (option 1) and vice versa (option 2). User shall be able to specify the type of conversion (a menu of two options). Display an error message if an invalid option is specified. Otherwise, the program would read in a length in feet and inches (two separate integer...

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

  • # convert.py # A program to convert Celsius temps to Fahrenheit # by: Susan Computewell def...

    # convert.py # A program to convert Celsius temps to Fahrenheit # by: Susan Computewell def main(): celsius = eval(input("What is the Celsius temperature? ")) fahrenheit = 9/5 * celsius + 32 print("The temperature is", fahrenheit, "degrees Fahrenheit.") main() PORTION ONE: Based the convert.py, so it can convert temperatures from Fahrenheit to Celsius, instead of original Celsius to Fahrenheit. Make sure to change the message to reflect the change of introduction and final result. Name it as: convert_v2.py. Run it...

  • Can you help me to create this program, please? Prompt the user for the user for...

    Can you help me to create this program, please? Prompt the user for the user for a number of degrees in Fahrenheit as an int. That number should be passed to a function named ffocREFO. This function will do the necessary calculation to convert the passed temperature to degrees Celsius as a double. The function MUST have a void return type and have the following prototype: void ffccREF(double& celsius, int Faren); In your main, display both the entered temperature and...

  • Write a C++ program that prompts a user to enter a temperature in Fahrenheit as a...

    Write a C++ program that prompts a user to enter a temperature in Fahrenheit as a real number. After the temperature is entered display the temperature in Celsius. Your program will then prompt the user if they want to continue. If the character n or N is entered the program will stop; otherwise, the program will continue. After your program stops accepting temperatures display the average of all the temperatures entered in both Fahrenheit and Celsius. Be sure to use...

  • i need a python code For an exact conversion between "Fahrenheit temperature scale" and "Celsius temperature...

    i need a python code For an exact conversion between "Fahrenheit temperature scale" and "Celsius temperature scale", the following formulas can be applied. Here, F is the value in Fahrenheit and the value in Celsius: Temperature Conversions C = 5 9 (F - 32) F = (š xc) + 3 Write a Python program that uses the above formula to convert Celsius to Fahrenheit and vice versa. We ask user to input "Enter a degree: ", and then we get...

  • For this portion of the lab, you will reuse the program you wrote before That means...

    For this portion of the lab, you will reuse the program you wrote before That means you will open the lab you wrote in the previous assignment and change it. You should NOT start from scratch. Also, all the requirements/prohibitions from the previous lab MUST also be included /omitted from this lab. Redesign the solution in the following manner: 1. All the functions used are value-returning functions. 2. Put the functions in an external module and let the main program...

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

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
ADVERTISEMENT