Question
Task: Write a program that defines a class Circle and implement it as required. The class Circle should consist of three private member variables: radius
Task:
Write a program that defines a class Circle and implement it as required. The class Circle should consist of three private member variables: radius of type double, Pi of type double and color of type string. Circle should also include the following member functions:
1. to output the area and diameter of the circle.
2. to set Pi to the value of 3.14159.
3. to set the radius according to the parameters.
4. to set the color according to the parameter.
5. to return Pi.
6. to return the radius.
7. to return the color.
8. to return the area of the circle. area = pi* radius * radius.
9. getCircumference to return circumference of the circle. circumference = 2 * pi * radius
10 .A default constructor to initialize radius 1 pi to 3.14.159 and color to white.
11. A constructor that initializes radius, Pi and color according to the parameters.
You should put the class definition in a header file Circle.h and put the class implementation in an implementation file Circle.cpp.
In the function main, write statements to test your class Circle ensuring that all functions are tested and executed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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