A polyline is a line with segments formed by a list of points of type MyPoint. Lets
Question:
A polyline is a line with segments formed by a list of points of type MyPoint. Lets use the ArrayList (dynamically allocated array) to keep the points. It contains: ? A private instance variable: an ArrayList of tAyPoint objects
? A default (or "no-argument" or "no-arg") constructor that constructs an empty ArrayList.
? An overloaded constructor that constructs a Poly Line object with the given list of MyPoint.
? An overridden tostring() ) method that returns a string description of the polyline in this format: { (xl, yl) (x2, y2) (x3, y3)...}
? A method named appendMyPoint(MyPoint) which appends a MyPoint object to the end of the current polyline.
? An overloaded method appendMyPoint(x, y) which appends a MyPoint(x, y) to the end of the current polyline
? A method named removeLastMyPoint() that removes the last MyPoint from the current polyine.
? A method named getMyPoint(index) that returns the MyPoint object at the specified position in this polyline. Write the PolyLine class in the answer box below assuming that the MyPoint class has been done for you in the system. Note - keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks.
For example:
Now. add a few methods to your PolyLine class to extend its functionality. Starting with your solution to the previous task (or re-typing it all if you are keen!), now add the methods below: ? A method named getsize() that returns the number of MyPoint objects in the current polyline.
? A method named get Length() that returns the total length (distance) of this polyine.
? A method named join(another) that joins the given polyline to the end of the current polyline.
Write the Polyline class in the answer box below assuming that the MyPoint class has been done for you in the system.
For example: