Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program to input 5 circles using array in the following question. Define the Circle class that contains: * Two double data fields named
Write a program to input 5 circles using array in the following question.
Define the Circle class that contains: * Two double data fields named x and y that specify the center of the circle with get methods. A data field radius with a get method A no-arg constructor that creates a default circle with (0, 0) for (x, y) and I for radius. * * A constructor that creates a circle with the specified x, y, and radius. . A method getArea that returns the area of the circle. . A method getPerimeter that returns the perimeter of the circle. . A method contains(double x, double y that returns true if the specified point (x, x) is inside this circle. See Figure (a) A method overlaps(Circle circle) that returns true if the specified circle overlaps with this circle. Two circles overlap if the distance between the two centers are less than or equal to sum of the radius of two circles (this.radius + circle.radius). See Figure (b) * Fig: (a) A point is inside the circle. (b) A circle overlaps another circle. Implement the class. Write a test program that creates a Circle object cl (new Circle(2.2.5.5)) displays its area and perimeter, and displays the result of cl.contains(3.3 and cloverlaps(new Circle(3. 5.2.3). (12 points)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