Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions

Question

Recognize the power of service guarantees.

Answered: 1 week ago

Question

Demonstrate how to use the Gaps Model for diagnosing and

Answered: 1 week ago