Question: Java. No loops , just basic java. Assignment Weight in Space (10 pts) Remember our class activity where e calculated a user's weight on the

Java. No loops, just basic java.

Java. No loops, just basic java. Assignment Weight in Space (10 pts)

Assignment Weight in Space (10 pts) Remember our class activity where e calculated a user's weight on the moon? - Let's see if we can expand it to provide more options for the user - Instead, we will calculate how the user's weight changes on different planets. Working by yourself, create a Java project called Planet. Our assignment will make use of many of the skills we have already learned: Switch statements Logical Operators Strings and String comparison Arithmetic operators and expressions Begin your program by declaring a double variable named weight, and a String variable named planet. You will need to write a switch statement with a series of cases, like the following - switch (planet) I case "Mercury": weight MRRCURY MUL T: 0.3B breski /reat of caaea Your default clause gives you the opportunity to do some error checking on the user input. If the user inputs an invalid planet, you should output the message "You entered an invalid name for a planet. Please re-run the program to try again." . - To provide the proper weight, you will need to know the conversion rate for each of the planets. The conversion is as follows Mercury - multiply by 0.38 -Venus multiply by 0.91 -Mars - multiply by 0.38 Jupiter - multiply by 2.54 Saturn - multiply by 1.08 -Uranus multiply by 0.91 Neptune multiply by 1.19 Pluto -multiply by 0.06 Note that to avoid magic numbers, you will need to declare a final variable for each of the multipliers above. Your final variables should look like this Final dauble MERCURY MULT0.38 Important: The output for the weight should only have one number after the decimal point. Therefore, you need to make use of System.out.printf to print out the weights rather than printlrn Your program should work identically to the following, except user input will vary: Welcome ! What do you weigh on other planeta? Enter your weight in paunds: 123 Now, select from one of the following planeta: Mercury Venus Jupiter Saturn Uranus Neptune Piuto Please enter the planet: Merury You weigh 46.7 1bs on ercury

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!