subject
Computers and Technology, 20.10.2021 09:10 indya2

You need to write a program in C++ that reads in the mass of an object (in kg) and output the weight (in N) on the Earth, on the Moon, and on Venus. An object's mass can be measured in kilograms. The weight is measured in newtons. So an object of a specific mass (in kilograms) would have one weight (in newtons) on the earth and a different weight on the moon. Your program will read in the mass (in kilograms) and convert it to newtons for the Earth, the Moon, and Venus.
So, on the Earth we can convert kilograms to newtons with the following expression:
weight = mass * 9.81
where 9.81 is the acceleration due to gravity on earth (in meters per second squared or m/s^2).
On the Moon this formula would be:
weight = mass * 1.62
where 1.62 is the acceleration due to gravity on the moon (m/s^2)
Finally, for Venus it would be:
weight = mass * 8.87
Again, all of the above assume the mass is in kilograms (kg) and the weight is in newtons (N).
If the weight on the earth is greater than or equal to 1500 newtons output a message saying the object is heavy.
If the weight on the earth is less than 5 newtons say it is light.
The mass and weight should use fixed notation with a precision of 4 digits to the right of the decimal point. The 1st column has a width of 8 characters and the 2nd column has a width of 14 characters. The 1st column is left justified and the 2nd column is right justified.
Use double variables and constants in your calculations.
The acceleration values must be defined as const double values. These are the 9.81, 1.62 and 8.87 values from above.
If the mass is less than or equal to 0 output a message saying the mass must be greater than 0.
See the sample output below for the exact syntax of the messages.
For example, assume the input is:
101.9367991
The output will be as follows The mass is 101.9368 kg Location Weight (N) Earth Moon Venus 1000.0000 165.1376 904.1794 Another example is when the object is light 0.50 The output will be as follows The mass is 0.5000 kg Location eight (N) Earth Moon Venus The object is light 4.9050 0.8100 4.4350 Here is the case where the value is too heavy: 155 With output: The mass is 155.0000 kg Location Weight (N) Earth Moon Venus The object is heavy 1520.5500 251.1000 1374.8500 Finally, we have the case where the mass is invalid 20.5 With output The mass is -20.500 kg The mass must be greater than zero.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:30
Which of the following methods could be considered a “best practice” in terms of informing respondents how their answers to an on-line survey about personal information will be protected? respondents are informed that investigators will try to keep their participation confidential; however, confidentiality cannot be assured. respondents are informed that a research assistant will transfer all the research data to a password-protected computer that is not connected to the internet, via a usb flashdrive. the computer is located in a research team member’s office. the investigator uses the informed consent process to explain her institution’s method for guaranteeing absolute confidentiality of research data. the investigator uses the informed consent process to explain how respondent data will be transmitted from the website to his encrypted database without ever recording respondents’ ip addresses, but explains that on the internet confidentiality cannot be absolutely guaranteed.
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
question
Computers and Technology, 23.06.2019 00:30
Write the html code to make a link out of the text “all about puppies”. it should link to a pdf called “puppies.pdf” inside the “documents” folder. the pdf should open in a new window.
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Which of the following is not a way in which trees benefit the environment? a. they remove a significant amount of carbon dioxide from the atmosphere. b. they remove a significant amount of oxygen from the atmosphere. c. their roots hold soil in place, reducing rates of erosion. d. they remove ozone and particulates from the atmosphere. select the best answer from the choices provided a b c d
Answers: 1
You know the right answer?
You need to write a program in C++ that reads in the mass of an object (in kg) and output the weight...
Questions
question
Mathematics, 01.10.2021 09:10
question
Mathematics, 01.10.2021 09:10
question
Social Studies, 01.10.2021 09:10
question
Mathematics, 01.10.2021 09:10
question
Mathematics, 01.10.2021 09:10
question
Mathematics, 01.10.2021 09:10
question
Social Studies, 01.10.2021 09:10
Questions on the website: 13722360