The ball moves on the rope and uses the object-oriented idea to compile the model.
Class rope {private point start; private point end; Public rope (point start, Point End) {This. start = start; this. end = end;} public point nextpoint (point currentpoint) {/* The next vertex of the current vertex can be calculated through the mathematical formula of the 2.1 line. This detail is not a problem to be considered during the design phase, if the current vertex is a termination vertex, null is returned. If the current vertex is not an online vertex, an exception is thrown */} class ball {private rope; private point currentpoint; public ball (rope, point startpoint) {This. rope = rope; this. currentpoint = startpoint;} public void move () {currentpoint = rope. nextpoint (currentpoint); system. out. println ("Move the ball to" + currentpoint );}}