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

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

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem we will create a Circle class in a programming language such as Python Here are the stepbystep instructions Step 1 Define the Ci... View full answer

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 Programming Questions!