Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

Students also viewed these Databases questions

Question

Explain internal recruitment methods.

Answered: 1 week ago

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago