import java.awt.*;
seeseeauthor
public class SolarSystem {
private Sun sun;
private Planet[] planets;
private int nPlanets;
private AstroCalendar instance;
public SolarSystem (AstroCalendar instance) {
this.instance = instance;
sun = new Sun(instance);
nPlanets = 9;
planets = new Planet[nPlanets];
planets[0] = new Mercury(instance);
planets[1] = new Venus(instance);
planets[2] = new Earth(instance);
planets[3] = new Mars(instance);
planets[4] = new Jupiter(instance);
planets[5] = new Saturn(instance);
planets[6] = new Uranus(instance);
planets[7] = new Neptune(instance);
planets[8] = new Pluto(instance);
}
public AstroCalendar getInstance() {
return instance;
}
public Sun getSun() {
return sun;
}
paramindexreturn
public Planet getPlanet(int index) {
if (index < 0 || index > nPlanets) {
return null;
} else {
return planets[index];
}
}
public int getNumberOfPlanets() {
return nPlanets;
}
}