Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a class to model a circle. Name this class Circle 1. The class should include data members for radius, x and y. 2. Include
Create a class to model a circle. Name this class Circle
1. The class should include data members for radius, x and y.
2. Include a default and explicit constructor. The explicit constructor will receive a radius value and an x.y coordinate. Make sure that the default constructor sets the radius to 1 x.y position to 1,1
3. Include setter/getter member methods for each data member.
4. Include methods for computing the circumference and area
Test this class by instantiating Circle objects as follows:
- Instantiate three Circle objects, cl,c2, and c3. Use explicit values in the construction of cl and c2. Allow the default constructor to assign default values to c3.
- Use the setRadius0 setter method to re-assign cl a small radius value and c2 a larger radius value.
- Do NOT re-assign the third circle a radius value; instead, retain the value assigned at construction.
- Display all the values for all the Circle objects
Step by Step Solution
★★★★★
3.34 Rating (160 Votes )
There are 3 Steps involved in it
Step: 1
Circle Class package myPackage public class Circle Data Members double radius int x x coordinate int y y coordinate Default Constructor Circle thisrad...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