Question: Rug Create a class called Rug that inherits from Rectangle. Then give the Rug class a price variable. The length, width and price of the
Rug
Create a class called Rug that inherits from Rectangle. Then give the Rug class a price variable. The length, width and price of the Rug should be set in the constructor of the Rug class. Give the Rug class a getPrice method that returns the price. Also give the Rug class an overridden str method that returns a string that is a report on the data in a Rug object.
Carpet
Create another class called Carpet that also inherits from Rectangle. It should have a pricepersquarefoot variable. The length, width, and pricepersquarefoot are set in the constructor of the Carpet class. Give the Carpet class a getPrice method that calculates the price of the Carpet and returns it Also give the Carpet class an overridden str method that returns a string that is a report on the data in a Carpet object.
Create main.py
You should have a file for main.py which has the main function inside. You will import the Carpet and Rug objects. Create an even number of Rug objects and an odd number of Carpet objects. Each of those objects should be put into a List object. Then code a loop that iterates through the List and uses the str method to print a description of each object out.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
