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 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: definitselfinLength, 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
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 Height Hypotenuse Area
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
