Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You may remember from high school science that while mass is a constant, weight is dependent on mass multiplied by how strong the gravitational pull
You may remember from high school science that while mass is a constant, weight is dependent on
mass multiplied by how strong the gravitational pull of the planet is So if you were to travel to
different planets, the weight of an object would change. In this lab, you are asked to compute just how
much an object would weigh on the other planets in our solar system.
Here is the table of relative gravitational strength as compared to earth:
Planet Relative Strength
Mercury
Venus
Mars
Jupiter
Saturn
Uranus
Neptune
What you need to do
Your task is to write a program which asks the user to input a weight and displays that weight scaled
appropriately on each of the other planets
Example
Please enter the weight youd like to convert:
Here is the weight on other planets:
Mercury lbs
Venus lbs
Mars lbs
Jupiter lbs
Saturn lbs
Uranus lbs
Neptune lbs
Redirect the output to a file named labbtxt Note that when you do this, the program wont display
text on the screen anymore. Youll still need to type a number in and hit enter. This wont be captured
by the redirection either. Thats expected behavior.
For an extra challenge, right align the column of numbers using the proper scan code format.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started