Respuesta :
Answer:
#include <iostream>
#include<iomanip>
using namespace std;
int main()
{
double mass,e,m,v;
cout<<"Enter the mass : ";
cin>>mass;
cout<<"The mass is "<<mass<<" kg\n";
if(mass<=0){
cout<<" mass must be greater than zero";
return 0;
}
e= mass * 9.81;
m= mass * 1.62;
v = mass * 8.87;
cout.setf(ios::fixed);
cout<<"Location"<<right<<setw(10)<<"Weight\n";
cout<<"Earth"<<right<<setw(15)<<setprecision(4)<<e<<endl;
cout<<"Moon"<<right<<setw(15)<<setprecision(4)<<m<<endl;
cout<<"Venus"<<right<<setw(15)<<setprecision(4)<<v<<endl;
cout<<endl<<endl;
if(m>=1500)
cout<<"Object is light weight";
else
cout<<"Object is heavy weight";
}
Explanation:
The program is a sequential program, and it does not require loops or conditional statements.
The program in Python is as follows, where comments are used to explain each line:
#This gets input for the mass of the object
mass = float(input("Mass: "))
#This calculates the weight of the object on Earth
Earth = mass * 9.81
#This calculates the weight of the object in Mars
Mars= mass * 1.62
#This calculates the weight of the object in Venus
Venus = mass * 8.87
#This prints the weight of the object on earth
print("Weight on Earth: {:.2f}".format(Earth))
#This prints the weight of the object in Mars
print("Weight on Mars: {:.2f}".format(Mars))
#This prints the weight of the object in Venus
print("Weight on Venus: {:.2f}".format(Venus))
At the end of the program, the weights are printed to two decimal places.
Read more about similar programs at:
https://brainly.com/question/19688338