Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions

Question

Find the derivative. f(x) 8 3 4 mix X O 4 x32 4 x32 3 -4x - x2

Answered: 1 week ago

Question

Is it clear what happens if an employee violates the policy?

Answered: 1 week ago