Question
[ 5pts ]Define the class Circle with private data member radius (double). The class must have a default constructor and a constructor with parameters. Include
[5pts]Define the class Circle with private data member radius (double). The class must have a default constructor and a constructor with parameters.
Include set/get functions for the radius data member
Include the function area that returns the area of the circle.
Overload the insertion operator << for the circle to display its radius and area.
Overload the operator < as a nonmember function for the circle. It should return a Boolean type. Bool operator < (Circle& c1, Circle& c2).
[5pts]Include exception handling in methods setRadius and the constructor of problem 1, in the Circle class. The class must throws out_of_range exception when the parameter to setRadius is negative. The handler must simply print the value and state it is out of range and do nothing. Demonstrate the working of the exception.
Define the class Circles with private data members size (int) and clist(Circle*). This class holds an array of dynamically allocated circles.
Include a default constructor that sets size to zero and clist to NULL.
Include constructor with parameter that receives a parameter for size and dynamically allocates the same number of locations for circles and assigns the return pointer to clist.
Include a copy constructor for the class Circles
Include an assignment operator for the class Circles.
Include a destructor for the class Circles.
Include a print function in the class that displays all circles.
Write a main function to test this class by creating an object of the type Circles, populate the object with at least three circle objects. Then invoke the print function to list all circles.
Verify the copy constructor and assignment operators work correctly.
[5pts] Define a STL set data type to hold Circles. Use the insert function of the set to populate the set with at least five circle. Next search for a circle in the set and verify the iterator returned in pointing to the element that was being searched for.
[5pts] Define a STL map
[5pts] Create a list (from STL) of 10 Circle objects.
Generate Circles with random integer (between 1 and 5) for radius to populate the list
Print the list using for_each function.
Shuffle the list and print again.
Use find_if to check if there is a circle with radius 5.
Remove all duplicates and print the list
Sort the list and print again.
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