Problem

(The Triangle class) Design a class named Triangle that extendsGeometricObject. The class...

(The Triangle class) Design a class named Triangle that extendsGeometricObject. The class contains the following:

Three double data fields named side1,side2, andside3 to denote three sides of the triangle.

A no-arg constructor that creates a default triangle with each side 1.0.

A constructor that creates a rectangle with the specified side1,side2 ,and side3.

The constant accessor functions for all three data fields.

A constant function named getArea() that returns the area of this triangle.

A constant function named getPerimeter() that returns the perimeter of this triangle.

Draw the UML diagram that involves the classesTriangle andGeometric- Object. Implement the class. Write a test program that prompts the user to enter three sides of the triangle, enter a color, and enter 1 or0 to indicate whether the triangle is filled. The program should create aTriangle 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 filled or not.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT