Question: CODE IN JAVA USING ENUM Develop an enum Planet to represent the planets of the solar system. Each planet has 2 fields: an integer of
CODE IN JAVA USING ENUM


Develop an enum Planet to represent the planets of the solar system. Each planet has 2 fields: an integer of the number of moons, and a boolean of whether it is a Jovian or terrestrial planet: name # of moons type Mercury 0 terrestrial Venus 0 terrestrial Earth 1 terrestrial Mars 2 terrestrial Jupiter 67 Jovian Saturn 62 Jovian Uranus 27 Jovian Neptune 14 Jovian Write a program named PlanetInfo that a) Lists each planet by type Iterate on an array of all the planets, determine its type, and print as given in the sample on the next page. b) Print all the planets along with the number of moons, sorted by the number of moons in ascending order. Using built-in sorting methods are not allowed. Implement selection sort for sorting. c) Prompts the user to enter the planet name, then displays the number of moons. Sample output: Terrestrial planets. MERCURY VENUS EARTH MARS Jovian planets. JUPITER SATURN URANUS NEPTUNE POO Planets with number of moons (ascending order). MERCURY VENUS EARTH 1 MARS 2 NEPTUNE 14 URANUS 27 SATURN 62 JUPITER 67 Enter a planet name: Saturn SATURN has 62 moons
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
