Before I get into detail, YES this is a HOMEWORK ASSIGNMENT. NO I DON'T WANT ANSWERS, JUST TIPS. The one of the direction of the assignment states this
"Modify your SolarModel to allow for two Planets instead of one."
Things to keep in mind:
SolarModel is a class that creates a solar system model with a Planet object (it's own separate class with a Position, Direction, and Mass parameters [Not too important for this case]), a Sun object (also, with it's own Position, Direction, and Mass parameters), and a double Tick (a tick is an amount of time in which planets rotate that changes position - again, don't think it's important for the problem I am having).
The whole package of codes is based on a hierarchy, "why?" (you might ask). I don't know why, it's just the topic I am learning in class.
Here is what I have in my SolarModel class:
public class SolarModel {
protected Sun sun;
protected Planet planet;
protected Planet planetb;
protected double tick;
public SolarModel (double tick, Sun sun, Planet planet) {
this.tick = tick;
this.sun = sun;
this.planet = planet;
}
There are more code to this, but are not important to this problem because they are just getters, setters, and a method that uses the tick to update position of the planet object...blah, blah, blah. Again, there's more to this class, just not important.
My problem (restated), is how do I use the same constructor for my SolarModel to occupy two planets? Thanks in advance.
Planetargument.