Question: python Lab 6 A: Design and implement a program that implements the following 3 methods: - Method isValid ( . . . ) returns True

python Lab6A: Design and implement a program that implements the following 3 methods:
- Method isValid(...) returns True if the sum of the width and height is greater than 30. Otherwise, returns False
isValid(width, height)
- Method area(...) returns the area of the rectangle.
area(width, height)
- Method perimeter(...) returns the perimeter of the rectangle.
perimeter(width, height)
Prompt the user to enter the width and height of a rectangle (as floats) and use the methods above to print out a message followed by the area and perimeter if the rectangle is valid. Otherwise, it prints out only the message This is an invalid rectangle.
Note: that method isValid() is used to validate the input before attempting to compute the area and perimeter.
Allow the user to re-run the program with different inputs using a loop structure. The user input is indicated in bold.
Sample output:
Enter width: 4.0
Enter height: 5.0
This is an invalid rectangle.
Do you want to enter another width and height (Y/N)?: Y
Enter width: 20.0
Enter height: 15.0
This is a valid rectangle.
The area is: 300.0
The perimeter is: 70.0
Do you want to enter another width and height (Y/N)?: N
Program Ends

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!