Answered step by step
Verified Expert Solution
Link Copied!

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 get_area 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 get_volume 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 10, call get_area, and display the area.
Have your code create a Pyramid with a length, width, and height of 10, call get_volume, 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

blur-text-image

Get Instant Access with AI-Powered 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