Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A polyline is a line with segments formed by a list of points of type MyPoint. Let's use the ArrayList (dynamically allocated array) to keep

image text in transcribed

image text in transcribed

A polyline is a line with segments formed by a list of points of type MyPoint. Let's use the ArrayList (dynamically allocated array) to keep the points It contains A private instance variable: an ArrayList of MyPoint objects A default (or "no-argument" or "no-arg" constructor that constructs an empty ArrayList. An overloaded constructor that constructs a PolyLine object with the given list of MyPoint. An overridden tostring() method that returns a string description of the polyline in this format: ((x1,y1) (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: Result PolyLine line - new PolyLine) line.appendMyPoint (new MyPoint(1, 2)) line.appendMyPoint(3, 4); line.appendMyPoint(5, 6); System.out.println(line)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions