Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions