Question

In: Computer Science

Python Programming You can calculate a person’s weight on the different planets within our solar system...

Python Programming

You can calculate a person’s weight on the different planets within our solar system by multiplying their mass by the gravity factor on the surface of the planet.

Weight = Earth Weight x Surface Gravity Factor

Planet

Surface Gravity Factor

Mercury

0.38

Venus

0.91

Moon

0.165

Mars

0.38

Jupiter

2.34

Saturn

0.93

Uranus

0.92

Neptune

1.12

Pluto

0.066

\

For example if you weigh 100 pounds on earth on Mars you would be:

Mars Weight 38 = 100 x .38

You Must Code the following:

  1. Declare Named Constants for each of the planet Surface Gravity Factors. Make sure you name them per the suggested rule in the book.
  2. Prompt the user for a Name and their Earth Weight
  3. Convert the entered Weight to the appropriate numeric data type that can store decimal points
  4. Multiple the Earth Weight by each of the planet’s Surface Gravity Factor
  5. Refer to the sample output below and make sure you include the following requirements:
    • Output the inputted name and make sure the words Solar System’s includes the single quote
    • Make sure all the computed planet weights are lined up exactly in the sample output
    • The outputted weight needs to take up 10 positions with 2 decimal points.
    • Test with 70.5 to make sure code works. Then try your own weight.
  6. Use comments to document your code

Put s prefixes in front of variables that contain string values and n prefix for variables that contain numbers.

Please include screenshots. thank you.

Solutions

Expert Solution

/******************************main.py***********************/

#declaring constant
MERCURY = .38
VENUS = .91
MOON = .165
MARS = .38
JUPITER = 2.34
SATURN = .93
URANUS = .92
NEPTUNE = 1.12
PLUTO = 0.066
#input name and Weight on earth
sName = input("Enter Your Name: ")
nWeight = float(input("Enter Weight: "))
#calculate Weight on Each Planet
weightOnMercury = nWeight * MERCURY
weightOnVenus = nWeight * VENUS
weightOnMoon = nWeight * MOON
weightOnMars = nWeight * MARS
weightOnJupiter = nWeight * JUPITER
weightOnSaturn = nWeight * SATURN
weightOnUranus = nWeight * URANUS
weightOnNeptune = nWeight * NEPTUNE
weightOnPluto = nWeight * PLUTO
#print Weight on each Planet
print(sName+"'s Weight on \"Solar System\"")
print("Planet\t\tWeight")
print("MERCURY\t\t%.2f"%weightOnMercury)
print("VENUS\t\t%.2f"%weightOnVenus)
print("MOON\t\t%.2f"%weightOnMoon)
print("MARS\t\t%.2f"%weightOnMars)
print("JUPITER\t\t%.2f"%weightOnJupiter)
print("SATURN\t\t%.2f"%weightOnSaturn)
print("URANUS\t\t%.2f"%weightOnUranus)
print("NEPTUNE\t\t%.2f"%weightOnNeptune)
print("PLUTO\t\t%.2f"%weightOnPluto)

Please let me know if you have any doubt or modify the answer, Thanks:)


Related Solutions

Our weight on different planets in the solar system will differ due to the varying size...
Our weight on different planets in the solar system will differ due to the varying size and mass of each of the planets. Write a C program, weight.c, to compute the weight of a 200 pound person on the following planets, based on the data below:     Planet  Percent of Earth Weigh ------  ------------------------ Mercury               37.8% Venus       90.7% Mars        37.7% Jupiter                   236.0% Saturn      91.6% Uranus      88.9% Neptune     112.0%       The program should generate the following outputs:  ...
programming in Python The body mass index (BMI) is calculated as a person’s weight (in lb)...
programming in Python The body mass index (BMI) is calculated as a person’s weight (in lb) times 720, divided by the square of the person’s height (in inches). A BMI in the range 19-25, inclusive, is considered healthy. Write a program that inputs people’s weight and height, then calculates a person’s BMI and print a message telling whether they are above, within, or below the healthy range. A formula for computing Easter in the years 1982-2048, inclusive, is as follows:...
2. There are 8 confirmed planets in our solar system. The number of significant figures in...
2. There are 8 confirmed planets in our solar system. The number of significant figures in this number is 1. True or False? Explain. 3 Do the following calculations, reporting the correct number of significant figures in your answer. a) 6.53x10^3g/12.8mL b) 5.621mL+ 22.4mL+5mL c) 3.3mm x 23.4mm x 1.769mm d) (965.43 x 3.911)+ 9413.4136 4. Preform the following conversions, reporting the correct number of significant figures in your answers. a) 1.976 x 10^-3 g to micro g b) 1.25...
Discuss the formation of the solar system. List the planets of the solar system, discussing their...
Discuss the formation of the solar system. List the planets of the solar system, discussing their properties, attributes, and missions that explored them.
I.       According to Kepler’s Law, the planets in our solar system move in elliptical orbits around...
I.       According to Kepler’s Law, the planets in our solar system move in elliptical orbits around the Sun. If a planet’s closest approach to the Sun occurs at t = 0, then the distance r from the center of the planet to the center of the Sun at some later time t can be determined from the equation r = a (1 – e cos f) where a is the average distance between centers, e is a positive constant that...
Create an enumeration named Planet that holds the names for the eight planets in our solar...
Create an enumeration named Planet that holds the names for the eight planets in our solar system, starting with MERCURY equal to 1 and ending with NEPTUNE. Write a program named Planets that prompts the user for a numeric position, and display the name of the planet that is in the requested position. For example, if 3 is input, the output would be: EARTH is 3 planet(s) from the sun Answer in C# (Posting incomplete and probably wrong code that...
the Sun displays limb darkening. For all the planets in the solar system, predict whether or...
the Sun displays limb darkening. For all the planets in the solar system, predict whether or not you expect to also observe limb darkening . Explain your predictions.
Description: Our solar system is very diverse when it comes to the gas composition on our...
Description: Our solar system is very diverse when it comes to the gas composition on our planets. On Mercury, which has almost no atmosphere, the pressure is less than 10-14 bar. Venus on the other hand has a much more dense atmosphere than earth, with a pressure of 92 bar. Instructions: Write a response to the following prompt and then respond to your peers. Would having different atmospheric pressures have an effect on the accuracy of gas laws? If so,...
What do you think will happen within our culture and our health care system as genetic...
What do you think will happen within our culture and our health care system as genetic screening becomes more accurate and more common? 200 words at least
Is every galaxy in the universe rotating in the same way as our solar system?
Is every galaxy in the universe rotating in the same way as our solar system?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT