Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE SHOULD BE IN JAVA FORMAT This assignment will use an enum to help us calculate your user's weight on other planets by utilizing their

image text in transcribedimage text in transcribed

CODE SHOULD BE IN JAVA FORMAT This assignment will use an enum to help us calculate your user's weight on other planets by utilizing their Earth weight. Start out by creating a Java with Ant application project in NetBeans. Name the project Homework6 and name the application Planetary Weight. In your project create an enum named Planets in package my.planet.enums. The members of the enum will be the 9 one-time planets (we'll keep Pluto in there) of the Solar System. We will use the Java Constant naming convention to name each element of the enum. Each element will have two attributes: String planetName; double gravityFactor; The values are as follow: Planet Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto Gravity Factor 0.38 0.91 1.0 0.38 2.34 1.06 0.92 1.19 0.06 Use the IDE to create an all-argument constructor and use Refactor/Encapsulate Fields to create getters for each attribute. Don't create any setters. You will also use the IDE to create a toString method. Modify the method so it only returns the planetName attribute of the enum. Once the enum is completed, start on the Planetary Weight application. Your output should print a header when the user first enters the application. Then, in a loop (for or while) prompt the user to enter an integer weight. Use an object for loop to calculate that weight on each planet. The algorithm for converting the planetary weight is; Entered weight * gravity factor Using printf statements make your output look like the following. Each line will use a format that will print Strings right justified with a width of 10, including an underscore made up of 10 equal signs under the header. Separate the headings with a tab. Planet names should be a right- justified String of 10 characters (upper/lower case) and the weight should be right justified, delimited, with a width of 10 and a precision (number of digits after the decimal point) of 2. At the end of the loop ask the user if they want to do the calculations again. Assume that the user gives you good integer) data. Once you're finished submit the entire project to the assignment. Weight Calculator Enter your weight on Earth => 150 Planet Weight Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto 57.00 136.50 150.00 57.00 351.00 159.00 138.00 178.50 9.00 Wanna go again? (y) => |

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions