Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The main function needs to generate 15 random shapes from circles, triangles and rectangles. The code needs to draw them and print their total area.
The main function needs to generate 15 random shapes from circles, triangles and rectangles. The code needs to draw them and print their total area.
Having issues with making the code, this is on Python!
Topic: objects, inheritance This assignment will give you practice on writing classes and understanding inheritance. You will define several type of shapes: circle, rectangle, and right triangle. These shapes translates directly to classes. Each shape has its own data, a draw method and a get area method. Once you have written the classes, you will write a program that will randomly create 15 shapes and have the shapes draw themselves. The screen shown below is the result of a sample run. Shape Circle has a class variable turtle, initialized to a Turtle object. t hon Turtle Graphes Mot Responding inherits Shape has a center point, a tuple of x and y has a radius has a draw method has a get_area method Rectangle inherits Shape has an upper_left point has a lower_right point has draw method has get_area method RightTriangle inherits Shape has two points A and B. has draw method has get_area method main function Generates 15 random shapes. Draw them Print their total areaStep 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