public class Spring extends PhysicsElement { private static int id=0; // Spring identification protected final double restLength; private final double stiffness; protected Ball a_end, b_end; private Spring(){ // nobody can create a spring without state this(0,0); } public Spring(double restLength, double stiffness){ super(id++); this.restLength = restLength; this.stiffness = stiffness; a_end = b_end = null; } public void attachEnd (Ball sa) { // note: we attach a spring to a ball, if(a_end==null) // not the other way around. a_end = sa; // to be completed by you } private double getStrech() { if ((a_end == null) || (b_end == null)) return 0; double ax=a_end.getPosition(); double bx=b_end.getPosition(); if (ax