Question: hello, this is python code, i need your help to use my client code and complete the program. thanks. here is my client code to
hello, this is python code, i need your help to use my client code and complete the program. thanks.


here is my client code to start with.

here is the expected results.

I appreciate your help, Thanks!
Furniture Inheritance In this assignment, you will be creating an inheritance hierarchy of classes used to handle the different types of furniture items in a store. The class hierarchy is shown in the following diagram: Furniture Bed Table Specifically, 1) Add a base class called Furniture: a. Add a private attribute called weight which represents the weight of the furniture in lbs. b. Add a constructor that takes one argument, weight in lbs. The constructor should set the private attribute called_weight. It should throw a ValueError exception saying "Weight must be positive" if the weight argument is less than or equal to 0. C. Add a public property called weight backed by _weight private attribute. Setter of this property should make sure new value is positive, otherwise should throw a ValueError exception saying "Weight must be positive" and NOT update the _weight attribute. d. Add a _str_method that returns a string of the form "Item Weight: weight" e. Make the Furniture class comparable. The comparison should be based on the weight property. (which special methods do you need to add here?) 2) Add a Table class which is derived from the Furniture class. a. Add an additional public attribute wood that represents the material the table is made from. b. Add a constructor that takes two parameters: weight in lbs and wood. Should throw an exception if weight is less than or equal to 0 or wood argument is not a string (Hint: you can use the isinstance built-in function to check the class of the argument to be str) c. Add a str_() method that returns a string that says: "Table Item Weight: weight Made of: wood." where the value of weight comes from its weight property and the value of wood comes from its wood property. This method should use the string returned by the base class_str_method. 3) Add a Bed class which is also derived from the Furniture class. a. Add a public attribute size that represents the size of the bed. Allowed values: "Twin", "Full, "Queen", and "King" b. Add a constructor that takes two parameters: weight in lbs and size. The constructor should throw an exception if weight is less than or equal to 0 or size argument is not one of the allowed values. c. Add a str_() method returns a string that says: "Bed Item Weight: weight Size: size" where the value of weight comes from its weight property and the value of size comes from its size property. This method should use the string returned by the base class __str_ method. 4) Add a Furniture Gallery class. a. Add a private attribute called _furnList which is a list of Furniture class (and derived classes) objects. b. Add a constructor with no arguments that initializes the _furnList to empty list. c. Add a method called addFurniture that takes an argument which is supposed to be a Furniture class (or derived class) object. Method should verify that the argument is one of the Furniture or derived classes and add it to __furnList. d. Add a sort method that sorts the_furnList list based on weight. Make this class iterable so that it can be used in a for-loop to iterate over the objects in the list. (What special method do you need to add here?) 5) Write all the four the classes in a single file called furniture.py. Now run the provided furnitureClient.py file. It should run without errors and should give the output as shown in the screenshot of the sample run below. NOTE: you shouldn't modify the client code. It just has to run correctly and give output as shown in the screenshot below. e. from furniture import FurnitureGallery, Furniture, Table, Bed def main(): TableData = [[100, "Pine"], [ 75, "Oak"], [-30, "Teak"], [50, 501] BedData = [[200, "King"], [150,"Queen"], [95, "Twin"]] 1 furn = FurnitureGallery() for k, row in enumerate(TableData): try: print("Adding...",k, end=" wt, wd = row s = Table (wt, wd) furn.addFurniture(s) print(". ....Success") print() except Exception as e: print() print(e) for k, row in enumerate(BedData): try: print("Adding...",k, end=" wt, SZ = row S = Bed (wt, sz) furn.add Furniture (s) print(".... Success") print( except Exception as e: print() print(e) ") for fin furn: print(f) print("After sorting") furn.sort() for fin furn: print(f) if _main__.": name main() IDLE Shell 3.9.2 File Edit Shell Debug Options Window Help NJIANI. U., uvuorey LuvI/ Etayyluun-14 Adding....... Success Adding... 1 .... Success Adding... 2 Weight cannot be negative Adding... 3 Wood should be of type string Adding... 0 .... Success Adding... 1 Success . Adding... 2 .... Success Table Item Weight: 100 lbs Made of: Pine Table Item Weight: 75 lbs Made of: Oak Bed Item Weight: 200 lbs Size: King Bed Item Weight: 150 lbs Size: Queen Bed Item Weight: 95 lbs Size: Twin After sorting Table Item Weight: 75 lbs Made of: Oak Bed Item Weight: 95 lbs Size: Twin Table Item Weight: 100 lbs Made of: Pine Bed Item Weight: 150 lbs Size: Queen Bed Item Weight: 200 lbs Size: King
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
