Question: For Python 3 Write a class definition for a triangle -include a constructor that creates instance variables base and height. The constructor should take two

For Python 3

Write a class definition for a triangle

-include a constructor that creates instance variables base and height. The constructor should take two arguments which will be used to set the values of the instance variables base and height.

-include getters and setter for the instance variables base and height

-include a method that returns the area of a triangle. It should refer to the instance variables of base and height. It should not take any arguments.

Instantiate a triangle object. Print both the base and height using the getters. Using the setters chang the base and height to 5 and 10, respectively. Then print the area.

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 Databases Questions!