Question
Note: It should be the same in figure2 (Yellow Page).
roblem find the weight of an object/imatter on different planets it is important first to explore the To difference between mass and weight. Mass is a measurement o is the force generated by the gravitational attraction of one o change when we change planets. f the amount it contains and weight This mass does not However, if we went from Earth to Mars, weight would change less gravity than Earth. Gravity is a force pulling matter together. Gravity of a bject on another use Mars has planet can be calculated by using following formula G M r2 Where . G is a gravitational constant whose value is 6.673x10 · M is mass of the planet in Kilograms . r is radius of the planet in meters. Diameter is equal to 2 times of radius. Weight of any object/ matter can be computed as acceleration due to gravity force (F) times mass of an object, that can be represented as w F*m Where m is the mass of an object/matter Following table shows the mass and diameter of the planets. Diameter Planets Mass (Kgs) Mercury | 3.3011 Venus 4.867x104 1 Earth 5.98x0 4.879x 10 1.2104x10 1.276x10 Mars 6417x0 6794x10 Jupiter 1.8990 1429x10 Saturn 5.6850 1205x10 1.429x10 1.205x10 5.112x10 4.953x10 Uranus 8.682x10 55 tune 1.024x1026 Pluto 1.471x10 2.37x1
media%2Fd8b%2Fd8b03a04-d973-41e3-834d-7c
0 0
Add a comment Improve this question Transcribed image text
Answer #1

// C++ program to calculate the mass of an object in a planet

#include <iostream>

#include <string>

#include <iomanip>

using namespace std;

int main() {

               string name;

               double mPlanet,dPlanet,rPlanet,mObject;

               cout<<"\t\tComputing Weights of objects on different Planets"<<endl;

               cout<<"********************************************************************************"<<endl<<endl;

               // inputs

               cout<<" Please enter the name of planet : ";

               cin>>name;

               cout<<" Enter the mass of Planet(M) : ";

               cin>>mPlanet;

               cout<<" Enter the diameter of Planet : ";

               cin>>dPlanet;

               cout<<" Enter the mass of an object(m) : ";

               cin>>mObject;

               const double g = 6.673e-11; // gravitational constant

               rPlanet = dPlanet/2; // calculate the radius of planet

               // calculate gravity of planet

               double fg = g*mPlanet/(rPlanet*rPlanet);

               // calculate weight of object in planet

               double w = fg*mObject;

               // output

               cout<<endl<<" "<<left<<setw(20)<<"Planet"<<left<<setw(20)<<"Gravity m/s"<<left<<"Weight of Object Kgs"<<endl;

               cout<<" "<<left<<setw(20)<<"******"<<left<<setw(20)<<"*******"<<left<<"*********************"<<endl;

               cout<<" "<<left<<setw(20)<<name<<left<<setw(20)<<fixed<<setprecision(1)<<fg<<left<<setprecision(3)<<w<<endl;

               return 0;

}

//end of program

Output:

Computing Weights of objects on different Planets Please enter the name of planet Earth Enter the mass of Planet(M)5.98e24 Enter the diameter of Planet 1.276e7 Enter the mass of an object(m) 15 Planet Gravity m/s Weight of Object Kgs k* Earth 9.8 147.052

Add a comment
Know the answer?
Add Answer to:
Note: It should be the same in figure2 (Yellow Page). roblem find the weight of an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT