Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Note : Please don t send the AI generated answer. AI generated answer doesn t help me at all. I need answer from the tutor.
Note : Please dont send the AI generated answer. AI generated answer doesnt help me at all. I need answer from the tutor. Thank you.
Topic name : Planet Enumeration
we have to work with some data on planets using an Enum class.we have
data on each planet, how many moons they have, and whether the planet is terrestrial or
Jovian. To put it simply, terrestrial planets are formed from rock and metal, while Jovian planets
are formed of gas and metal.
Planet # of Moons Type
Mercury Terrestrial
Venus Terrestrial
Earth Terrestrial
Mars Terrestrial
Jupiter Jovian
Saturn Jovian
Uranus Jovian
Neptune Jovian
We need to create an Enum class called Planet. Each planet has two fields: an integer
representing the number of moons, and a Boolean representing whether the planet is
terrestrial or Jovian. We have to Ensure that our class and Enum values follow naming standards.
Now we need to write any getters and setters our Enum class might need.
We have to create a class called PlanetInfo with a main method. When the main method
runs, print out each planet and how many moons they have.
We also have to modify the main method of PlanetInfo so that it prompts the user to enter in the name of a planet using a Scanner. The program will then print out whether that planet is
Jovian or terrestrial.
The sample run of the main method :
MERCURY has moons
VENUS has moons
EARTH has moons
MARS has moons
JUPITER has moons
SATURN has moons
URANUS has moons
NEPTUNE has moons
Enter a planet:
Neptune
NEPTUNE is Jovian
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