Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please solve to pyhton3 for beginner level (with screenshots) Design a class named Triangle that extends the GeometricObject class given in the textbook. The Triangle

please solve to pyhton3 for beginner level (with screenshots) image text in transcribed
Design a class named Triangle that extends the GeometricObject class given in the textbook. The Triangle class contains: - Three float data fields named side1, side2, and side3 to denote the three sides of the triangle. - A constructor that creates a triangle with the specified side1, side2, and side3 with default values 1.0. - The accessor (getter) and mutator (setter) methods for all three data fields. - The class should throw a RuntimeError exception if the three given sides cannot form a triangle (If one of sides is 0 or less than 0. .) - 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__eq_(self, other) that checks whether two triangles are equal of not by comparing their three sides. For example, if a triangle has side lengths 4,1,3 and another one has side lengths 3,4,1 then they should be accepted equal. - A method named _str__) that returns a string description for the triangle. The _str_0 method is implemented as follows: return "Triangle: side1 = " + str(side1) + " side = " + str(side2) + " side 3= " + str(side 3 ) 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

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

Students also viewed these Databases questions

Question

Solve the following equations. 29-4y=2y-7

Answered: 1 week ago

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago

Question

5. Describe the relationship between history and identity.

Answered: 1 week ago