Question: Design and implement class Circle to represent a circle object. The class defines the following attributes (variables) and methods: 1. A private variable of type

Design and implement class Circle to represent a circle object. The class defines the following attributes (variables) and methods: 1. A private variable of type double named radius to represent the radius. Set to 1. 2. A non-argument constructor method to create a default circle. 3. Constructor method that creates a circle with user-specified radius. 4. Method getRadius() that returns the radius. 5. Method setRadius() that sets the radius. 6. Method getArea() that returns the area. 7. Method getPerimeter() that returns the perimeter. 8. Method toString()to printout a meaningful description of the circle as follows: The circle has radius X. Where X is the value of variable radius. Now design and implement a test program to create a default circle object and test all class methods on the object. Print the object after each method call and use meaningful label for each method call as shown in the following sample run. Sample run: Print radius: The radius is 1. Print area: The area is 3.14 Print perimeter: The perimeter is 6.28 Set radius to 10 and print the object: The circle has radius 10. Print area: The area is 314.23 Print perimeter: The perimeter is 62.81

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!