Question
One class that I need for a homework: The Collection class stores a drawing area and shapes. It should have a constructor accepting 4 int
One class that I need for a homework:
The Collection class stores a drawing area and shapes. It should
have a constructor accepting 4 int inputs that respectively denote the lowest x position, the highest x-position, the lowest y-position, and the highest y-position over which the class should display in its window;
have an addShape function that, when provided with a std::shared ptr object, adds it to the collection;
have a display function to display its shapes only over the appropriate range of x and y-values, from the lowest to highest values inclusive, printing * if there is a part of a shape at a point and - if there is no part of a shape a point; following this, it should list the shape types, in the order they were added to the collection and this function must make use of dynamic pointer cast (other means of doing the same thing are possible but the point of this exercise is to practice using dynamic pointer cast so you must do it here);
have a totalStars function to return the total number of stars that are within the plot range;
have a moveBy function taking two arguments, the first describing how much to move all shapes in the x-direction and the second describing how much to move all shapes in the y-direction; and
have a setSize function taking a single argument and setting the size property of all shapes.
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