
1.4. Models in Physics 13
With two MassObjects
3
coded with the laws of gravity and force, creating
two mass objects is pretty straightforward:
class MassObject { double mass, position; }
For programmers familiar with procedural programming, this MassObject
is like a record set storing the mass’ attributes. The programming environ-
ment, where the objects are created for the actual simulation, is given by
the main(...) method. The two participating objects are created by
MassObject earth = new MassObject(5.98e24, 0 );
MassObject moon = new MassObject(7.35e22, 384404 );
Physics teaches that all masses are aware of each other—every mass
is interacting with ...