Question: Problem Description: 1 - Design a class named Triangle that extends GeometricObject. The class contains: Three data fields are named side 1 , side 2

Problem Description:
1- Design a class named Triangle that extends GeometricObject. The class contains:
Three data fields are named side1, side2, and side3 with default values 0 to denote three sides of the triangle (6 points).
A constructor that creates a triangle with the specified side1, side2, side3, and color, and filled. Make sure you use the parametrized super() method. (11 points)
The accessor methods for all five data fields that are used in the constructor. (10 points)
A method named getArea() that returns the area of this triangle. (8 points)
A method named getPerimeter() returns the perimeter of this triangle. (8 points)
A method named toString() returns a description for the triangle including the 3 sides and the color and filled from GeometricObject (12 points)
Implement the class:
2- Write a test program TestTriangle.py that creates:
a- an object of GeometricObject you call go1 with: (5 points):
color= Blue
filled = False
b- displays all the parameters of go1 using the toString() created in GeometricObject(5 points)
c- an object of Triangle you call t1 with: (10 points)
side1: 1, side2: 1.5, side3: 1
filled uses the filled of go1
color uses the color of go1
d- displays the area of t1(2.5 points)
e- displays the perimeter of t1(2.5 points)
f- displays the color of t1(2.5 points)
g- displays the filled of t1(2.5 points)
h- displays all the values of t1 using the toString() created in Triangle(5 points)
Files to be submitted:
a- GeometricObject.py(10 points)
b- Triangle.py(55 points)
c- TestTriangle.py(35 points)

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 Programming Questions!