Question
Topic: switch statement C++ The force of gravity is different for each of the nine planets in our solar system. For example, on Mercury it
Topic: switch statement C++
The force of gravity is different for each of the nine planets in our solar system. For example, on Mercury it is only 0.38 times as strong as on Earth. Thus, if you weigh 100 pounds on Earth, you would weigh only 38 pounds on Mercury. Write a program that allows you to enter your Earth weight and your choice of planet to which you would like your weight converted to. Calculate your weight on the chosen planet. Display your Earth weight, your weight on the desired planet to atenth of a decimal point, and the name of the planet you chose. Design a menu for the planet choices.
The relative forces of gravity for each planet are:
Jupiter 2.65
Mars 0.39
Mercury 0.38
Neptune 1.23
Pluto 0.05
Saturn 1.17
Uranus 1.05
Venus 0.78
Sample Output:
Your weight on earth: 152.5 lbs.
Planet Chosen: Neptune
Your weight on the chosen planet: 187.6 lbs.
Would you like to calculate another weight (Y or N): y
This program converts your weight on Earth to your weight on the planet of your choice.
Please enter your weight on planet Earth: 165.5
Please enter the number that follows your planet of choice.
MERCURY: 1
VENUS: 2
MARS: 3
JUPITER: 4
SATURN: 5
URANUS: 6
NEPTUNE: 7
PLUTO: 8
Planet Number = ? 2
Your weight on earth: 165.5 lbs.
Planet Chosen: Venus
Your weight on the chosen planet: 129.1 lbs.
My teacher hasn't taught us how to use a switch statement for C++
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