Question: Q 1 . Create a Rectangle class in Python that stores the width and height of a rectangle and includes get and set methods to
Q Create a Rectangle class in Python that stores the width and height of a rectangle and includes get and set methods to modify them. Also, add a method named area to calculate the area of the rectangle.
The width and height of the rectangle should be greater than zero. When attempting to set the width or height to a value less than zero, print the message "Width must be greater than zero." or "Height must be greater than zero." to the screen and do not change the value.
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
