Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a new Triangle class that extends the abstract Geometric Object class. Dr

ID: 3564024 • Letter: D

Question

Design a new Triangle class that extends the abstract Geometric Object class. Draw the UML diagram for the classes Triangle and GeometricObject and then implement the Triangle class. Write a test program that prompts the user to enter three sides of the triangle, a color, and a Boolean Value to indicate whether the triangle is filled. The program should create a Triangle Object with these sides and set the color and filled properties using the input. The program should display the area, perimeter, color, and true or false to indicate whether it is filled or not. Additionally modify your triangle class to implement the comparable and serializable interfaces.

Explanation / Answer

The GeometricObject

The Triangle program

The Testprogram.

You need to create a new Triangle object like this, so that you have a reference

You also need to set it's filled and color properties

Then, you can invoke its methods like this:

You're able to access the GeometricObject's isFilled(), setFilled(), getColor(), and setColor() because a Triangle is a GeometricObject (extends), so it inherits all its methods.

By the way, this is not how to calculate the area of a triangle:

Check out this link for correct formula

Edit: With another problem with code

Edit: Triangle Formula

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote