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

What is your school subject? We have no tutors who specialize in C++.

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")

Certainly! Here's a Python program that accomplishes the task:

```python
def calculate_weight():
mass = float(input("Enter the object's mass in kilograms: "))
weight = mass * 9.8

if weight > 1000:
print("The object is too heavy.")
elif weight < 10:
print("The object is too light.")
else:
print("The object's weight is", weight, "Newtons.")

calculate_weight()
```

Explanation:
1. First, we define a function called `calculate_weight()` which asks the user to input the mass of an object in kilograms using the `input()` function and converts it to a float using `float()`.
2. The weight is then calculated by multiplying the mass with the acceleration due to gravity, which is approximately 9.8 m/s^2 on Earth.
3. We use an if-elif-else statement to check the value of `weight` and display the appropriate message based on the conditions.
4. If the weight is greater than 1000, we print "The object is too heavy."
5. If the weight is less than 10, we print "The object is too light."
6. Otherwise, if the weight falls between 10 and 1000, we print "The object's weight is [weight] Newtons."

To run this program, you can copy the code into a Python IDE, such as IDLE, and execute it.