Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 5 . 1 ( The Triangle class ) Design a class named Triangle that extends GeometricObject. The class contains the following: Three double data

15.1(The Triangle class)
Design a class named Triangle that extends GeometricObject. The class contains the following:
Three double data fields named side1, side2, and side3 to denote three sides of the triangle.
Constructors:
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 and mutator 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.
A constant function named printTriangle() that returns a string that displays the area, perimeter color, and truetialse to indicate whether filled or not.
Submit the following:
Draw the UML diagram that involves the classes Triangle and GeometricObject. (2 points)
Implement the class. (6 points)
Write a test program that prompts the user to enter three sides of the triangle, enter a color, and enter 1 or 0 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 filled or not. (2 points)
image text in transcribed

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

Step: 3

blur-text-image

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions