Question: Write a Python class called RightTriangle that conforms to the following specifications. The class has 3 private member variables: length, height, and hypotenuse. When a

Write a Python class called RightTriangle that conforms to the following
specifications.
The class has 3 private member variables: length, height, and hypotenuse.
When a RightTriangle object is created, the user enters the length and height.
The constructor will look like: def__init__(self,inLength, inHeight)
The hypotenuse is calculated inside the constructor from length and height. The
formula is the square root of the length squared plus the height squared (Pythagorean
Theorem).
There is method called findPerimeter that returns the perimeter of the triangle. This
is calculated by length + height + hypotenuse.
There is a method called findArea to find the area of the right triangle. It is given by
(1)/(2)* length* height.
There are accessors and mutators for height, length, and hypotenuse.
There is a toString method that returns a string of the form of the following example:
Length =8 Height =6 Hypotenuse =10.0 Area =24
Store this class in a Python File called RightTriangle.py

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!