import java.util.*; import java.io.*; public class MyWorld { private PrintStream out; private ArrayList elements; // array to hold everything in my world. public MyWorld(){ this(System.out); } public MyWorld(PrintStream output){ out = output; elements = new ArrayList(); } public void addElement(PhysicsElement e) { elements.add(e); } public PhysicsElement getCollidingElement(Ball b) { for (PhysicsElement e: elements) if (e.collide(b) && (b!=e)) return e; return null; } private void printStateDescription(){ String s ="Time\t"; for (PhysicsElement e:elements) s+=e.getDescription() + "\t"; out.println(s); } private void printState(double t){ // to be coded by you String s = " "+t; for (PhysicsElement e:elements) s+="\t "+ e.getState(); out.println(s); } public void simulate (double delta_t, double endTime, double samplingTime) { // simulate time passing double t=0; printStateDescription(); printState(t); while (t