Create a class called rectangle to represent a rectangle


Assignment

Use python idle 3.6 please

Create a class called Rectangle to represent a rectangle. The class should contain:

· Two fields named width and height.

· A constructor that creates a rectangle with the specified width and height. The default values are 1 and 2 for width and height, respectively.

· The accessor and mutator methods for width and height.

· A method named getArea() that returns the area of the rectangle.

· A method named getPerimeter() that returns the perimeter of the rectangle.

Once you have completed the class, write a program to test it. Be sure to test all methods in the class as well as test the default settings.

Solution Preview :

Prepared by a verified Expert
Programming Languages: Create a class called rectangle to represent a rectangle
Reference No:- TGS02635891

Now Priced at $15 (50% Discount)

Recommended (99%)

Rated (4.3/5)