Question: Design a new Triangle class that extends the abstract GeometricObject class, implement the Comparable interface. Override the equals method in the Object class. A Triangle

 Design a new Triangle class that extends the abstract GeometricObject class,

Design a new Triangle class that extends the abstract GeometricObject class, implement the Comparable interface. Override the equals method in the Object class. A Triangle is represented by its three side length side1, side2, and side3, a color, and a Boolean value to indicate whether the triangle is filled. Two Triangle objects are equal if their sides, color and filled are the same. It should also compare two Triable objects whether one is equal to, greater than or less then from the other object using area sizes of objects. Write a test program that generates several Triangle objects with three sides, a color, and a Boolean value filled. The program should display each triangle's area, perimeter, color, and true or false to indicate whether it is filled or not; compare two Triangles objects with equals method; compare two Triangles objects using compare to method whether they are equal to, greater than or less then in area size. Draw the UML diagram that involves Triangle, GeometricObject, and Comparable. Hint: Use Heron Formula with sides a, b, and c to find the area of a triangle: S = a+b+c 2 Area= s(s a)(s b)(s c)

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!