Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Change the constructor of the class Circle so that it allows you to specify the color during construction. Add an accessor method to Circle that
- Change the constructor of the class Circle so that it allows you to specify the color during construction.
- Add an accessor method to Circle that returns the diameter of a circle.
- Add an accessor method to Circle that returns the color of a circle.
- Add a mutator method to Circle that will change a circle's x position to a new x.
- Add a mutator method to Circle that will change a circle's y position to a new y.
- Add a mutator method to Circle that moves a circle to a new location: (x, y).
- Add an accessor method to Circle that returns the distance of the circle from (0, 0): the origin. Use: (int)(Math.sqrt(someNumber)) to get the square root of someNumber. For example, the following code stores the value 10 in the variable x: int num = 100; int numSquareRoot = (int)(Math.sqrt(num));
- Complete the displayDetails method. It should display a circle's diameter, color, and coordinates exactly as in the following example: The red circle at (55, 120) has a diameter of 5.
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