Question: Write a Java program to develop a class Circle2D with the following specifications 1. Class circle2D ?nherits Circle class and implements Colourful nterface 2. The

Write a Java program to develop a class Circle2D with the following specifications 1. Class circle2D ?nherits Circle class and implements Colourful nterface 2. The class has three private attributes: color of type string, x, and y (both of type double), x and y attributes specify the center of the circle 3 The class has a Three-argument constructor that sets the value of its x, y, and radius to 4 The class has a zero-argument constructor that sets the value of its instance variables to 5. The class has to implement fillMyColour given values. It should invoke its super-class constructor. their default values. It should invoke its Three-argument constructor in the same class method, which assign the given string value to the color instance variable 6. The class has a private method distance double xl, double yl, double x2, double y2) that returns the distance between (xl.yl) and (x2, y2) Hint: distance between two points-(x2 - x1)2 (y2 -y1)2 7. The class has a public method contains (double xl, double yl) that returns true if (x1, yl) is inside the circle Hint: (xl, yl) is contained in the circle if the distance between (xl, yl) and the center of the circle represented by attributes (xy) less than or equal radius of the circle 8. The class has a public method contains (Circle2D circle1) that returns true if the specified circle! 1s inside this circle. Hint: the current circle contains circle1 if the distance between the two centers of the circles + circle1.radius less than or equal to this.radius. 9. The class has a public method overlaps (Circle2D circle1) that returns true if the specified circle1 overlaps with this circle. Hint: Two circles overlap if the distance between the two centers are less than or equal to this.radius + circlel. radius. 10.Override the Object's toString) method in order to return a string representation of the circle 2D Instance variables as the below format, it should invoke its super class tostring ) method: radius = , area = , perimeter = , center point of the circl e: , color is
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
