Reference no: EM132277136
Question: GeometricTriangle class
Design a class named GeometricTriangle that inherits from GeometricObject (what we did in class).
The class contains:
1. Three double data fields named side1, side2 and side3 with default values 1.0 to denote three sides of a triangle.
2. A default constructor that creates a default triangle
3. A constructor that creates a triangle with specified three sides.
4. The accessor and mutator methods.
5. A method named getArea() that returns the area of the triangle.
• Before the area is calculated check for valid input. Sum of any two sides should be greater than the third one. If not throw an IllegalArgumentException.
6. A method named getPerimeter() that returns the perimeter of the triangle.
7. A method named toString() that returns the string description for the triangle like for the circle and rectangle.
For a triangle with sides a,b and c area is calculated using semiperimeter s as shown below:
You can write a main to test the class the functions and the exception.
Information related to above question is enclosed below:
Attachment:- GeometricObject.rar