Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python only Design a class named Triangle that extends the given Geometricobject class. The Triangle class contains: Three float data fields named sidel, side2, and

image text in transcribed python only

Design a class named Triangle that extends the given Geometricobject class. The Triangle class contains: Three float data fields named sidel, side2, and side to denote the three sides of the triangle. A constructor that creates a triangle with the specified sidel, side2, and side 3 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. The formula for computing the area of a triangle is: (sidel + side 2 + side 3) SE area = s(s - sidel)(s - side2)(s - side3) 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. class GeometricObject: det _init__(self, color = "green", filled = True) : self._color = color self. filled = filled def getColor (self): return self. color def setColor (self, color): self. color = color def isFilled (self): return self. filled def setFilled (self, filled): self. filled = filled def str (self): return "color: " + self. color + 1 and filled: " + str(self. filled)

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

=+. What steps from RMF resonate most with you?

Answered: 1 week ago