Question: Design a new Triangle class that extends the abstractGeometricObjectclass, implement the Comparableinterface. Overridethe equalsmethod in the Object class. A Triangle is represented by itsthree sidelengthside1,side2,and

Design a new Triangle class that extends the abstractGeometricObjectclass, implement the Comparableinterface. Overridethe equalsmethod in the Object class. A Triangle is represented by itsthree sidelengthside1,side2,and side3,a color, and a Booleanvalue to indicate whether the triangle is filled.Two Triangleobjects are equal iftheir sides, color and filledare the same.It shouldalso compare two Triable objects whetheroneisequal to, greater than or less then from the other object using areasizes ofobjects.Write a testprogramthat generates several Triangle objects with three sides, a color, and a Booleanvalue filled. The program should display each trianglesarea, perimeter, color, and true or false toindicate whether it is filled or not; compare two Triangles objects with equalsmethod;compare two Triangles objectsusing compareTomethod whether they are equal to, greater than or less thenin areasize. Draw the UML diagram that involves Triangle,GeometricObject, and Comparable.Hint:Use Heron Formulawith sides a, b, and cto find the area of atriangle:

Design a new Triangle class that extends the abstractGeometricObjectclass, implement the Comparableinterface.

Question 1: 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 side 3, 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: B= 4 + c 2 Area= =(5-a)(5 bisc)

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!