Question: Part 2 (20 points): Write 3 subclasses for the Polygon class. Each of these subclasses should have the methods area() and perimeter() which calculate the

Part 2 (20 points):

Write 3 subclasses for the Polygon class. Each of these subclasses should have the methods area() and perimeter() which calculate the area and perimeter of the polygon respectively.

The first subclass is Rectangle, which should take 2 inputs: the side lengths of 2 adjacent sides of the rectangle.

The second subclass is Triangle, which should take 3 inputs: the side lengths of the 3 sides of the triangle

The third subclass is Circle, which should take 1 input: the radius of the circle.

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!