Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
Radius: a double
Pi: a double initialized to
The class will have the following member functions:
Default Constructor that sets the radius to even though the program does not use it
A Constructor that accepts the radius of the circle as an argument the program will use this
setRadius a mutator function for the radius variable
getRadius an accessor function for the radius variable
getArea returns the area of the circle area pi radius radius
getDiameter returns the diameter of the circle diameter radius
getCircumference returns the circumference of the circle circ 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 two decimal places. Use a separate header file for the class. Add a UML Diagram for
the class as a comment below main
The program will:
Use a separate h file for the class and a cpp file for main.
Use 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
pg 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 Introduction to Computer Science II
Assignments submitted after the due date will incur a grade penalty of three points per day after
the first day, and will not be accepted more than one week late.
Sample Main:
Chapter Programming Challenge : Circle Class
int main
double radius ; To hold a radius
Get the radius.
while radius
cout "Enter the circle's radius: ;
cin radius;
ifradius
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
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