4.1

Table Of Contents
CelestialBody.java Class
The CelestialBody.java class is a serializable class that defines a generic celestial body, that can be a star, a
planet, or a moon.
The CelestialBody class declares the following constructor and methods:
n
CelestialBody() constructor, to create a generic celestial body instance
n
getId() method, to return an object identifier
n
setId() method, to set an object identifier
n
getName() method, to return an object name
n
setName() method, to set an object name
Star.java Class
The Star.java class extends CelestialBody to create star objects.
The Star class adds the following constructor and methods:
n
Star() constructor, to create star instances
n
getCircumference() method, to return the circumference of a star
n
setCircumference() method, to set the circumference of a star
n
getSurfaceTemp() method, to return the surface temperature of a star
n
setSurfaceTemp() method, to set the surface temperature of a star
n
getPlanets() method, to return a list of planets that orbit a star
n
setPlanets() method, to set the list of planets that orbit a star
n
addPlanet() method, to add a planet to the list of planets that orbit a star
n
removePlanet() method, to remove a planet from the list of planets that orbit a star
Planet.java Class
The Planet.java class extends CelestialBody to create planet objects.
The Planet class declares the following constructor and methods:
n
Planet() constructor, to create planet instances
n
getCircumference() method, to return the circumference of a planet
n
setCircumference() method, to set the circumference of a planet
n
getGravity() method, to return the gravity of a planet
n
setGravity() method, to set the gravity of a planet
n
getMoons() method, to return a list of moons that orbit a planet
n
setMoons() method, to set the list of moons that orbit a planet
n
addMoon() method, to add a moon to the list of moons that orbit a planet
n
removeMoon() method, to remove a moon from the list of moons that orbit a planet
n
getStarId() method, to return the identifier of the star that the planet orbits
n
setStarId() method, to set the identifier of the star that the planet orbits
Chapter 7 Developing Plug-Ins
VMware, Inc. 153