Asked by Hassan
Write a program that asks the user to enter an object's mass, and then calculates and displays its weight. If the object weighs more than 1,000 Newtons, display a message indicating that it is too heavy. If the object weighs less than 10 Newtons, display a message indicating that the object is too light
Answers
Answered by
Reed
What is your school subject? We have no tutors who specialize in C++.
Answered by
Steve
I assume you have picked up some C++ by now, so you know how to build an object and define variables. The logic can be something like what follows, but expressed in C++, using cout and cin
print "enter mass: "
read mass
weight = mass * 9.8
print "Weight: ",weight,((weight>1000)? " -- Too heavy" : (weight<10) ? " -- Too light")
print "enter mass: "
read mass
weight = mass * 9.8
print "Weight: ",weight,((weight>1000)? " -- Too heavy" : (weight<10) ? " -- Too light")
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.