Question
4.2 Lab 19: Mass and Weight Using If-Else-If Scientists measure an objects mass in kilograms and its weight in newtons. If you know the amount
4.2 Lab 19: Mass and Weight Using If-Else-If
Scientists measure an objects mass in kilograms and its weight in newtons. If you know the amount of mass that an object has, you can calculate its weight, in newtons, with the following formula:
weight = mass * 9.8
Write a program that reads in an objects mass, and then calculates and displays its weight in the specified format.
If the object weighs more than 1,000 newtons, display the message "It is too heavy." If the weight is greater than 10 and less than or equal to 1000, display the message "It is a good weight." If the weight is greater than 0 and less than or equal to 10, display the message "It is too light." Otherwise (that is, the weight is zero or negative), display the message "Invalid weight. You should enter a mass greater than 0."
Your program should use an if-else-if construct.
Figure 1: (sample input)
1.3
Figure 2: (sample output)
The object's mass is 1.3 kilograms and the weight is 12.74 newtons. It is a good weight.
THIS IS FOR C++ PLEASE DO NOT ANSWER IN ANY OTHER LANGUAGE ONLY C++ LANGUAGE
THANK YOU
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started