Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Must create three files: circle.cpp circle.h and circledriver.cpp . circle.cpp must contain class implementation, circle.h must contain class documentation, and circledriver.cpp must contain main (
Must create three files: circle.cpp circle.h and circledriver.cpp circle.cpp must contain class implementation, circle.h must contain class documentation, and circledriver.cpp must contain main and any other functions that are not part of the class. Here are the instructions:
Class:
Name: Circle
Purpose: To accept and store the data for a circle and to provide functions that will manipulate the data.
Constructor:
Zeroargument constructor that initializes the data members to
Data Members:
radius int Must be or greater.
colorFill string Cannot be blank.
Functions:
calcDiameter double Calculates and returns the diameter of the circle. The diameter is a double.
calcArea double Calculates and returns the area of the circle. The area is a double.
calcCircumference double Calculates and returns the circumference of the circle. The circumference is a double.
setRadius void Accepts a radius value and updates the radius data member.
getRadius int Returns the value stored in the radius data member.
setColorFill void Accepts the fill color value and updates the colorFill data member.
getColorFill string Returns the value stored in the colorFill data member.
Note: Setters and Getters are required even if they are not used.
NonClass Functions:
displayCircleInfo void Creates and displays the formatted output of the book shipment information. Do a Google search for C setw left, right for how to use these functionscommands to create easy to read formatted output.
Formulas:
Note: The calc functions are returning a double, and the radius is an integer. The simplest way to convert an int to a double is to multiply the radius by Example: double myDiameter; myDiameter getRadius ;
Area Pi radius squared For Pi use the value of so your results will match mine. You can make this a const using the following line of code in the Circle.cpp file above the constructor const double PI ;
For radius squared, use the pow function instead of getRadius getRadius Example: pow is squared where is the value of the radius, and is the power to raise the radius to in this case, squared. Use the getRadius function to get the radius value.
Circumference PI radius
Diameter radius
The class should use appropriate protection levels for the member data and functions. Data members must be in the private: section. It must also follow principles of minimalization: that is no data member should be part of a class unless most functions of the object need it A general rule of thumb is that if you can easily calculate it dont store it
Program Flow:
Start a loop that goes until the user enters for the radius.
Create the Circle object using the zero argument constructor.
Prompt the user for the radius. If the user enters exit the loop, otherwise, update the Circle object with the value entered.
Prompt the user for the fill color and update the Circle object with the value entered.
Display the Circle information using a separate function. This function will call the Circle object functions defined in the class.
Pause the display so the user can read the displayed information.
Your program should allow the user to enter new circle radius until the user enters for the radius. Be sure to include appropriate error checking. Does it make sense to enter abc as the radius of a circle? No Therefore, you should ensure the user enters numeric data for the side. Negative numbers other than the to exit should also be prevented. Blanks are not allowed for the fill color.
Create a function named displayCircleInfo in the file that contains main
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