Question: Write a program that prompts the user to enter the weight of a person in pounds and outputs the equivalent weight in kilogram and solar

Write a program that prompts the user to enter the weight of a person in pounds and outputs the equivalent weight in kilogram and solar masses (used to measure the mass of stars and galaxies).

Output both the weight in pounds and kilograms rounded to two digits after the decimal place (trailing zeros if necessary). Output the weight in solar masses in scientific notation with 4 significant digits (for example, 102 would be output as 1.020e+002 in C++ scientific notation, which is short for 1.020 10002). The relationship between pounds and kilograms and the relationship between kilograms and solar masses should be declared in your program as constants named KILOGRAM_PER_POUND and KILOGRAM_PER_SOLAR_MASS respectively. Use these constants in the conversion formulas.

  • 1 pound = 0.453592 kilograms
  • 1 kilogram = 5.0279e-31 solar masses (or 5.0279 10-31 solar masses)

Hint: Remember that scientific notation always has exactly one significant figure before the decimal place and the rest are after the decimal place. If you want to remove the fixed manipulator, you can use a new manipulator called defaultfloat.

Name your source code file MassConverter.cpp.

Your program should match the following layout exactly.

 Write a program that prompts the user to enter the weight

rite a program that prompts the user to enter the weight of a person in pounds and outputs the quivalent weight in kilogram and solar masses (used to measure the mass of stars and galaxie: utput both the weight in pounds and kilograms rounded to two digits after the decimal place (tra Pros if necessary). Output the weight in solar masses in scientific notation with 4 significant digit xample, 102 would be output as 1.620e+002 in C++ scientific notation, which is short for 1.020 : 0902 ). The relationship between pounds and kilograms and the relationship between kiograms an olar masses should be declared in your program as constants named KILOGRAM_PER POUN and KILOGRAM PER SOLAR MASS respectively. Use these constants in the conversion formula - 1 pound =0.453592 kilograms - 1 kilogram =5.0279 e-31 solar masses (or 5.02791031 solar masses) Hint: Remember that scientific notation always has exactly one significant figure before the decimal place and the rest are after the decimal place. If you want to remove the fixed manipulator, you can use a new manipulator called defaultfloat. Name your source code file Massconverter.cpp Your program should match the following layout exactly Sample Output (user input is in yellow) Enter the weight in pounds: 184

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!