Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a public class MyCircles to the following specifications: The class has a private instance ArrayList , which represent a collection of Circle2D. The class

Develop a public class MyCircles to the following specifications:

The class has a private instance ArrayList, which represent a collection of Circle2D.

The class has a zero-argument constructor that creates and initializes the ArrayList instance object.

The class has a public method void addCircle2D (Object, String) which is used to add an instance object of Circle2D into the ArrayList. The String represents the name of the color that will fill the circle2D object.

The class has the method readFromFile (String). It reads from a text file which its name given as a string argument of the method. Then fills the ArrayList collection with the values of the circle2D instance objects. Hint: Each line in the file has 4 values representing x, y, and radius of type double consequently, followed by a string value represent the color.

The class has the method printAll(). It displays either a string representing each element in the ArrayList (one per line) or a string message that NO Shapes are available.

The class has the method check_Overlaps_Contains(), which displays which circles of the ArrayList are overlapped with each other, or contained in each other. The method should print a message format as follows:

Checking Overlaps and Contains

Circle: 0 with red color:

Overlaps with Circle:1 that has yellow color.

Contains Circle:2 that has blue color.

Circle: 1 with yellow color:

Overlaps with Circle:0 that has red color.

Contains Circle:0 that has red color.

Overlaps with Circle:2 that has blue color.

Hint: 0 and 1 represent the index of the objects in the ArrayList.

The class has the method check_contains_point(double x, double y), which displays which circles of the ArrayList contains point(x,y). The method should print a message format as follows:

The following circles containing the Point (, .)

**********************************************

Circle: 0 with red color.

.

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

Step: 3

blur-text-image

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

What's the silliest way you've ever gotten an injury?

Answered: 1 week ago

Question

2-5. What are the three main types of active listening? [LO-4]

Answered: 1 week ago