Fork and clone enumerable-planets.
Use the Get from Version Control option to open the project in IntelliJ.
In the project, navigate to the data package.
Create a new public enum called Planets
.
public enum Planets {
// list the planets here.
// Mercury, Venus, Earth, Mars, Jupiter,
// Saturn, Uranus, Neptune
// Don't forget to capitalization convention and enum
// syntax to separate value and end the list
}
Before adding any other fields to Planets
, go to PlanetController
and update the index handler to pass in a Model
class argument (eg. Model model
).
Use .addAttribute
to add the planet values to the model.
In templates/index
, create a list element and use the template
variable you have just defined in the controller to list all of the
planet values on the page.
Add a name
field to the planets.
Update the template to display the planet names.
Back in the Planets
enum, add a new field called yearLength
.
yearLength
should be the number of earth days of a year on the given planet.Change the index template to display a table of each planet name and its year in earth days.
templates/index
, create a table element and add the appropriate bootstrap class.yearLength
field.If you wish, add another field to Planets
. You can find plenty of information on NASA’s web site.