Question: [ 2 0 pts ] Task 1 [ 1 5 pts ] Define a class ShapeManager to manage multiple shapes in a graphical window with

[20 pts] Task 1
[15 pts] Define a class ShapeManager to manage multiple shapes in a graphical window with the following attributes and methods:
Attributes:
shapes (a list to store all shapes, e.g., circles, rectangles).win (a GraphWin object to display the shapes).
Methods:
add_circle(center, radius, color):
Add a circle to the shapes list with the specified center, radius, and color.
Draw the circle in the window.add_rectangle(bottom_left, top_right, color):
Add a rectangle to the shapes list with the specified corners and color.
Draw the rectangle in the window.change_color(index, color):
Change the color of the shape at the given index in the shapes list.
Update its appearance in the window.delete_shape(index):
Remove the shape at the given index from both the shapes list and the window.
[5 pts] Create a ShapeManager object and perform the following:
Create a GraphWin window with a title "Shape Manager" and dimensions 400x400 pixels.
Add a red circle with center (2,2) and radius 2.
Add a blue rectangle with bottom-left corner (3,3) and top-right corner (6,5).
Add a green circle with center (2,2) and radius 1.
Expected Outcome:
Note: The background color does not have to be the same as the example below.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!