Computer Science > QUESTIONS & ANSWERS > Design a class named Triangle that extends the Geometric Object Class. (All)
Design a class named Triangle that extends the GeometricObject class. The Triangle class contains: - Three float data fields named side1, side2, and side3 to denote the three sides of the tria ... ngle. - A constructor that creates a triangle with the specified side1, side2, and side3 with default values 1.0. - The accessor methods for all three data fields. - A method named getArea() that returns the area of this triangle. - A method named getPerimeter() that returns the perimeter of this triangle. - A method named __str__() that returns a string description for the triangle. Implement the Triangle class. Write a test program that prompts the user to enter the three sides of the triangle, a color, and 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 triangle’s area, perimeter, color, and True or False to indicate whether the triangle is filled or not. [Show More]
Last updated: 3 years ago
Preview 1 out of 2 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Feb 24, 2021
Number of pages
2
Written in
All
This document has been written for:
Uploaded
Feb 24, 2021
Downloads
0
Views
138
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·