Construct a class named Circle that has a floating-point data member named radius. The class should have a zero-argument constructor that initializes this data member to 0. It should have member...


Can you please help me write this in C++. I am so confused with all the added we have to implement. Thank you


Construct a class named Circle that has a floating-point data member named radius. The class<br>should have a zero-argument constructor that initializes this data member to 0. It should have<br>member functions named calcCircumterencel) and calcArea() that calculate the circumference<br>and area of a circle respectively, a member function setRadius(to set the radius of the circle, a<br>member function getRadius() to return the radius, and a member function showData() that<br>displays the circle's radius, circumference, and area. The formula for the area of a circle is<br>A-ar?. The formula for the circumference of a circle is C=2ar. Use your class in a program that<br>creates an instance of a Circle (utilizing the zero-argument constructor), prompts a user for a<br>radius, calls the şetRadius() function to set the circle's radius, and then calls showData() to<br>display the circle's radius, circumference, and area. Your program should allow the user to enter<br>circle dimensions until the user enters -1. Be sure to include appropriate error checking. Does it<br>make sense to enter

Extracted text: Construct a class named Circle that has a floating-point data member named radius. The class should have a zero-argument constructor that initializes this data member to 0. It should have member functions named calcCircumterencel) and calcArea() that calculate the circumference and area of a circle respectively, a member function setRadius(to set the radius of the circle, a member function getRadius() to return the radius, and a member function showData() that displays the circle's radius, circumference, and area. The formula for the area of a circle is A-ar?. The formula for the circumference of a circle is C=2ar. Use your class in a program that creates an instance of a Circle (utilizing the zero-argument constructor), prompts a user for a radius, calls the şetRadius() function to set the circle's radius, and then calls showData() to display the circle's radius, circumference, and area. Your program should allow the user to enter circle dimensions until the user enters -1. 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 that the user enters numeric data for the radius. Negative numbers (other than the -1 to exit) should also be prevented. showData() should not refer to the data members directly. Instead, it should call getRadius() to retrieve its value. Think of your getters and setters as middlemen. You should try to avoid accessing your data members directly due to maintenance issues. Pretend that you decided to change the name of your radius variable to be "rad". You really should only have to make that change in two functions: getRadius and setRadius. If you refer to the private data members directly throughout your code, you'll have a nightmare trying to make all the changes necessary. If you always use the getters to retrieve your data, any changes you make to the variable name will only necessitate changes to your get function rather than your whole code base. CalcCircumference. CalcArea, and ShowData should not have the radius passed in as an argument because radius is a data member of the class. Class functions have direct access to all data members in their own class. By passing in an argument for the value of the radius, you're not using the value that has already been stored in the data member. You're using the value that you've passed in to the functions, which circumvents the whole purpose of storing radius in the class. Be sure to avoid using global variables in your program unless they are constants. (Hint: a good constant to create in your program would be the value of pi.) • Finally, be sure not to include any unnecessary libraries.
AutoSave O Off<br>Document1<br>Word<br>P Search (Alt+Q)<br>Steven Brightwel<br>SB<br>File<br>Home<br>Insert<br>Draw<br>Design<br>Layout<br>References<br>Mailings<br>Review<br>View<br>Help<br>PDFelement<br>A Share<br>P Comments<br>Compiles and Executes without crashing<br>No global variables<br>Appropriate Internal Documentation<br>Rectangle Class Created:<br>Çircle.h (header file)<br>Circle.cpp (class file)<br>CircleDriver.cpp (Driver file)<br>Data members:<br>Appropriate data members are declared<br>Style:<br>Appropriate Pre-processing and using directives<br>Constructor:<br>Zero argument constructor initializes data member to zero<br>Member functions are correct and used correctly:<br>calcCircumference()<br>calcArea()<br>setRadius()<br>getRadius()<br>showData()<br>Protection:<br>Member functions and variables are declared with appropriate<br>protection (i.e. private or public)<br>Object Creation:<br>Page 2 of 3<br>D Focus<br>540 words<br>English (United States)<br>100%<br>

Extracted text: AutoSave O Off Document1 Word P Search (Alt+Q) Steven Brightwel SB File Home Insert Draw Design Layout References Mailings Review View Help PDFelement A Share P Comments Compiles and Executes without crashing No global variables Appropriate Internal Documentation Rectangle Class Created: Çircle.h (header file) Circle.cpp (class file) CircleDriver.cpp (Driver file) Data members: Appropriate data members are declared Style: Appropriate Pre-processing and using directives Constructor: Zero argument constructor initializes data member to zero Member functions are correct and used correctly: calcCircumference() calcArea() setRadius() getRadius() showData() Protection: Member functions and variables are declared with appropriate protection (i.e. private or public) Object Creation: Page 2 of 3 D Focus 540 words English (United States) 100%
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here