Fall 2017

Lab03
Planet Weight Calculator

Due: Tuesday September 27, 2016 11:59 PM

Lab03 - Planet Weight Calculator

Requirements

Flowchart is in the appropriate form with correct shapes and arrows10 pts
User is allowed to make the appropriate inputs15 pts
Program would calculate the correct weights15 pts
Pluto exception is handled correctly10 pts
Earth exception is handled correctly10 pts
Program continues at the end as described15 pts
Total75 pts

Resources

Objective

To practice with decisions and loops in flowcharts

Instructions

For this assignment you will need to create a flowchart that lays out the steps a program would need to follow to allow a user to enter their weight on Earth and then calculate what that person's weight would be on the other eight planets (plus Pluto) in our solar system.

The Planets

In your flowchart assume that you will be able to display a list of all of the planets for the user. You will then need to collect the user's choice from that list. It is possible for the user to make a choice of something that wasn't on the list so your flowchart should deal with that contingency.

Weight

The user should next be allowed to enter their "Earth weight" which is how much that person weights on Earth. If no weight is entered, the value entered is not numeric, or is less than 0 the user should be shown an error message before the program continues (see below).

If the user has entered their weight correctly then the value should be used to calculate their weight on the selected planet and the result of the calculation displayed for the user.

If the planet that is selected is Pluto (actually a dwarf planet) then a message should be displayed that informs the user that there is currently not enough known about Pluto to calculate their weight.

If the planet that is selected is Earth then a message should be displayed that informs the user that their weight is already known for Earth.

To find what a person would weigh on a planet, multiply their Earth weight by one of the following values depending on the currently selected planet.

Planet name Percentage of Earths gravity
Mercury 0.38
Venus 0.91
Earth 1.0
Mars 0.38
Jupiter 2.54
Saturn 0.93
Uranus 0.8
Neptune 1.2
Pluto unknown

Example: If a person's weight on earth was 190 lbs. Then multiplying 190 by 0.38 would give their weight on Mercury or Mars which would be 72.2 lbs. The units of weight (lbs or kg) are not important.

Continuing

After the user's calculated weight has been displayed the user should again be prompted, this time asking if they would like to perform another calculation. If the user indicates that they would like to continue they should return to the first step of selecting a planet. If the user indicates that they do not wish to continue the program should end.