Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python. Create a shape Class with one data member called side1 and two class methods called getArea and getPerimeter. They are empty methods or

Using Python.

Create a shape Class with one data member called side1 and two class methods called getArea and getPerimeter. They are empty methods or abstract methods. You can write empty methods as

def getArea(self):

pass

Or

def getArea(self):

Or

def getArea(self):

return

Or

def getArea(self):

return 0

Create a Class called Square as a subclass of Shape and implement the data member and methods side1, getArea and getPerimeter.

Create another Class called Rectangle as a subclass of Shape and implement Shape.side1 and Rectangle classs side2. Write the methods getArea and getPerimeter for Rectangle class.

Create another class called Triangle as a subclass of Shape and implement Shape.side1 and Triangles classs side2 and side3. Write the methods getArea and getPerimeter for Triangle class.

Please keep the scope of this assignment as simple as possible and learn the inheritance. That is the objective. Once we get all the concepts, we can expand by adding more functionalities.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

ISBN: 1844804526, 978-1844804528

More Books

Students also viewed these Databases questions