Click here to Skip to main content
15,891,993 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Develop a public class MyCircles to the following specifications:

1. The class has a private instance ArrayList<circle2d>, which represent a collection of Circle2D.

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

3. 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.

4. 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.

5. 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”.

6. 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.

7. 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. …………………………………………….

What I have tried:

I have tried to develop this code, so I have no idea how to start coding this.
Posted
Updated 29-Apr-18 21:53pm

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900