Question
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
The class has a zero-argument constructor that creates and initializes the ArrayList
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started