Assignment Chef icon Assignment Chef

[SOLVED] Cs150 – lab 23

5.0 1 customer review Digital download

Digital download

$25.00

Availability
In stock
Checkout
One item

Need a hand?

Message us on WhatsApp for payment or download support.

WhatsApp QR code

Modify Lab 22 so that the radius variable in class circle is private. Write a setter and getter function for radius, as well as a default constructor that initializes it to 0 and a constructor that takes one parameter for radius. If radius is given as a negative in a call to the setter or the constructor set it to 0 instead.
Create a program that defines a class called circle. Circle should have a member variable called radius that is used to store the radius of the circle. Circle should also have a member function called calcArea that calculates the area of the circle using the formula area = pi*r^2. Area should NOT be stored in a member variable of circle to avoid stale data.
Use a global constant for PI and set it to 3.14159.
In main, instantiate (declare/create) and use circle objects as needed to prove that all of your functions, including both constructors, work properly (construct a test case for your class in main).
Show a test run or runs of your own design proving that everything works.