Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

not really sure how to finish this code. please help and zoom in if needed, thank you! Scientists measure an object's mass in kilograms and

not really sure how to finish this code.

image text in transcribed

image text in transcribed

image text in transcribed

please help and zoom in if needed, thank you!

Scientists measure an object's 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 object's 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. Hint. The program will be easy to code if you check the greater-than-1000 condition first, then the greater-than-10 condition, then greater- than-0 condition. Think about the implied condition at each step. So your code may look like: if (weight > 1000) else if (weight > 10) I/implied condition: weight 0) I/implied condition: weight 6 #include 7 using namespace std; 8 double 9 10 int main() 11 { 13 14 Il variables int mass, weight; 16 output cout > mass, weight; calcuete eight = mass weight = mass 9.8 if (weight = 1800) cout 10) /implied condition: weight 0) //implied condition: weight

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions