We want to create a program, called TestP.java, to draw any object in a Display. Of course, the objects to draw must have a Draw method, but they could be trajectories, figures, images, ufos, etc. This program will be similar to the test program developed in the last laboratory session to draw trajectories, but TestP will not take care about what the classes of the managed objects are. It only requires that the objects implement the Draw method.
In this exercise, we will only use the trajectory classes developed in the last session laboratory.
Then, write a Java interface file, called DisplayDrawable, defining the following abstract method:
// Draw the trajectory in the given display // centered at position (x,y). public abstract void Draw(Display d, double x, double y);As all the classes used by TestP must implement this interface, modify the files CircularT, LinealT, SpiralT and LissajousT to implement the DisplayDrawable interface.
Create the TestP.java program making these modifications to the TestT.java program developed in the las session laboratory:
DrawDD(Display d, DisplayDrawable o);
Write classes to represent figures like triangles, rectangles, circles, boxes, polygons, etc, all of them implementing the DisplayDrawable interface.
Integrate them into the TestP.java program.