I was given a task in which I must implement an applet that mimics the solar system, which has a sun with orbits of the planets, and the planets should have moons orbiting the planets. I have successfully implemented the animation, but in order to get full credit, we need to use the following UML:

I understand that the framework has an instance Sun, but Sunimplements methods in the interface Orbitand has an instance OrbitingBodycreated using the constructor Planet, etc. I am not undesrtand - this is the relationship in UML between an interface Orbitand an abstract class OrbitingBody.
import java.awt.*;
@SuppressWarnings("serial")
public class Sun implements Orbit {
private Dimension dim;
private OrbitingBody earth;
private OrbitingBody mars;
public void init(Dimension dim) {
}
public void setPlanetPosition() {
}
public int calX(int distance, int angle){
}
public int calY(int distance, int angle){
}
public void draw(Graphics g) {
}
}
import java.awt.*;
@SuppressWarnings("serial")
public class Planet extends OrbitingBody implements Orbit {
private Moon moon;
private Moon eris;
Planet(int x, int y, Color color) {
super.x = x;
super.y = y;
moon = new Moon();
eris = new Moon();
this.color = color;
}
public int calX(int distance, int angle){
}
public int calY(int distance, int angle){
}
}
public interface Orbit {
int calX(int distance, int angle);
int calY(int distance, int angle);
}
import java.awt.*;
public abstract class OrbitingBody {
protected Color color;
protected int x, y;
protected int radius = 25;
void setPosition(int x, int y) {
this.x = x;
this.y = y;
}
public void draw(Graphics g) {
}
}
source
share