question archive (The Triangle class) Design a class named Triangle that extendsGeometricObject
Subject:Computer SciencePrice: Bought3
(The Triangle class) Design a class named Triangle that extendsGeometricObject. The class contains:
- Three double data fields named side1, side2, side3 with defaultvalues 1.0 to denote three sides of the triangle.
- A no-arg constructor that creates a default triangle.
- A constructor that creates a triangle with the specified side1,side2, and side3.
- The accessor methods for all three data fields.
- A method named getArea() that returns the area of thistriangle.
- A method named getPerimeter() that returns the perimeter of thistriangle.
- A method named toString() that returns a string description forthe triangle.
s = (side1 + side2 + side3)/2
area = Squareroot of s(s - side1)(s - side2)(s - side3)
Write a test program that creates a Triangle object with sides1,1.5,1, setting color yellow and filled true, and displaying thearea, perimeter, color, and whetherfilled or not.