Question: Task 3 Part 1 Design a class named Rectangle to represent a rectangle. The class must contain the following: 1. Two instance attributes named width

 Task 3 Part 1 Design a class named Rectangle to represent

Task 3 Part 1 Design a class named Rectangle to represent a rectangle. The class must contain the following: 1. Two instance attributes named width and height that specify the width and height of the rectangle respectively. 2. A default constructor that creates a rectangle with width and height of 1. 3. An overloaded constructor that createas a rectangle with the specified width and height. 4. A function named getArea() that returns the area of this rectangle. 5. A function named getPerimeter() that returns the perimeter of this rectangle. Part II Write a test program that does the following: 1. Creates two Rectangle objects. Assign width 4 and height 40 to the first object and width 3.5 and height 35.9 to the second. 2. Display the width, height, area, and perimeters of the first object and then the second object. In [ ]: "" Part I: The Rectangle class"". class Rectangle: #FIXME: implement the class here pass In [ ]: Part II: The tester".... #FIXME: Implement your tester in this cell

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!