project 107
Budget: $10 – $30 USD
The gravitations force is an important factor in how much an object weight. Write a program that aske the user to input their weight on earth (is really their mass) and the name of the planet. The program then calculates and outputs how much the person is weight on that planet.
Write a program that uses functions and switch statement instead of if structure to perform the calculations. The calculation should be done in a value returning function called from the main.
The following table gives the factor by which the weight must be multiplied for each planet. The program should output an error message if the user does not type the correct name of the planet name. The prompt and the error message should make it clear to the user how a planet name must be entered. Be sure to use proper formatting and appropriate comments in your code. The output should be clearly labeled and neatly formatted.
Mercury 0.4155 Saturn 1.0677
Venus 0.8975 Uranus 0.8945
Earth 1.0 Neptune 1.17947
Moon 0.166 Pluto 0.0899
Mars 0.3507
Jupiter 2.5374
Write a program that uses functions and switch statement instead of if structure to perform the calculations. The calculation should be done in a value returning function called from the main.
The following table gives the factor by which the weight must be multiplied for each planet. The program should output an error message if the user does not type the correct name of the planet name. The prompt and the error message should make it clear to the user how a planet name must be entered. Be sure to use proper formatting and appropriate comments in your code. The output should be clearly labeled and neatly formatted.
Mercury 0.4155 Saturn 1.0677
Venus 0.8975 Uranus 0.8945
Earth 1.0 Neptune 1.17947
Moon 0.166 Pluto 0.0899
Mars 0.3507
Jupiter 2.5374