Question: Create a circle class in a separate header file that has the following private member variables: 1 . Radius: a double 2 . Pi: a

Create a circle class in a separate header file that has the following private member variables:
1. Radius: a double
2. Pi: a double initialized to 3.14159
The class will have the following member functions:
1. Default Constructor that sets the radius to 0.0(even though the program does not use it)
2. A Constructor that accepts the radius of the circle as an argument (the program will use this)
3. setRadius a mutator function for the radius variable
4. getRadius an accessor function for the radius variable
5. getArea returns the area of the circle (area = pi * radius * radius)
6. getDiameter returns the diameter of the circle ( diameter = radius *2)
7. getCircumference returns the circumference of the circle (circ =2* pi * radius)
Requirements:
Using the main function on the next page, write a program that demonstrates the circle class by
prompting the user for the circles radius (with input validation), create a circle object using the
overloaded constructor, and then report the area, diameter, and circumference with the output
precision set to (2) two decimal places. Use a separate header file for the class. Add a UML Diagram for
the class as a comment below main (10%).
The program will:
Use a separate *.h file for the class and a *.cpp file for main.
Use 3.14159 as the value for pi
Include #ifndef and #endif directives as required
Have a UML diagram of the Class with access specifiers, parameters, and return types (ref Figure
13-22 pg 826) as a comment below main.
//**********************************
// CLASS NAME
//**********************************
// MEMBER VARIABLES
//
//**********************************
// MEMBER FUNCTIONS
//(with access specifiers, parameters,
// and return types)
//**********************************
Grading will be based on meeting all of the lab requirements, adherence to programming standards,
operation and accurate output, and programming style including white space and indentation.
CSE 112 Introduction to Computer Science II
Assignments submitted after the due date will incur a grade penalty of three (3) points per day after
the first day, and will not be accepted more than one (1) week late.
Sample Main:
// Chapter 13, Programming Challenge 8: Circle Class
int main()
{
double radius =0; // To hold a radius
// Get the radius.
while (radius <=0)
{
cout << "Enter the circle's radius: ";
cin >> radius;
if(radius <=0)
cout << "That is not a valid radius." << endl >
I need help with visual studio using C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!