Question: Write a class definition called RectangularSolid which takes three numeric parameters in its constructor, in this order: length, width, height. Provide a get_volume method that

Write a class definition called RectangularSolid which takes three numeric parameters in its constructor, in this order: length, width, height.

Provide a get_volume method that returns the volume of the rectangular solid. This method takes no parameters. Provide a get_surface_area method that returns the surface area of the rectangular solid. This method takes no parameters.

Provide mutators (setters) and accessors (getters) for each of the three parameters. Use the naming convention for these methods that is demonstrated in your textbook (i.e. do not use the property function or decorators).

These methods should allow a program using your code to modify the parameter values after creation and to read individual parameter values.

Test Result
r1 = RectangularSolid(3,4,5) print(r1.get_volume()) print(r1.get_surface_area()) r1.set_width(7) print(r1.get_width()) print(r1.get_volume()) print(r1.get_surface_area()) 
60 94 7 105 142

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 Databases Questions!