Create a class to model a circle. Name this class Circle 1. The class should include data
Fantastic news! We've Found the answer you've been seeking!
Question:
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
Related Book For
Posted Date: