Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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, 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started