Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create two classes, a Triangle class, and a Pyramid class. The Triangle class needs two self variables ( instance variables ) - height and base.
Create two classes, a Triangle class, and a Pyramid class.
The Triangle class needs two "self" variables instance variables height and base.
The Triangle class needs a getarea method that will return the area of the triangle.
The Pyramid class needs three instance variables length, width, and height.
The Pyramid class needs a getvolume method that will return the volume of the pyramid.
The formulas are easy to google, but if you need help with them, text me
Have your code create a Triangle with a height and base of call getarea, and display the area.
Have your code create a Pyramid with a length, width, and height of call getvolume, and display the volume.
Add a str method to each class if you don't use the @dataclass decorator.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started