Question
Create one base class, several abstract subclasses, and several concrete subclasses. Create the following: 1. A superclass (base class): i. A class called Shape 1.
Create one base class, several abstract subclasses, and several concrete subclasses. Create the following: 1. A superclass (base class): i. A class called Shape 1. It contains the an attribute called color 2. It contains the following methods: a. Constructor b. Methods called for printing c. Get and set methods for the attribute(s), if applicable 2. Several abstract subclasses: i. A class called TwoDShape that inherits from Shape 1. It contains the following methods: a. Constructor b. Methods called for printing c. Get and set methods for the attribute(s), if applicable d. get_area() and get_perimeter() calculation methods ii. A class called ThreeDShape that inherits from Shape 1. It contains the following methods: a. Constructor b. Methods called for printing c. Get and set methods for the attribute(s), if applicable d. get_volume() calculation method 3. Several concrete subclasses: i. 3 classes of your choosing that inherit from TwoDShape 1. Each class should contain its appropriate attributes 2. Each class should implement all necessary methods to make it a concrete class. Also implement __init__ and __str__. ii. 3 classes of your choosing that inherit from ThreeDShape 1. Each class should contain the appropriate attributes 2. Each class should implement all necessary methods to make it a concrete class. Also implement __init__ and __str__. 4. A main function, that contains code to: i. Constructs 6 objects one object for each of your 6 concrete subclasses ii. Calls print() on each object
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