Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A polygon is a shape with multiple sides. Polygon can be of different types: Triangle is the three- sided polygon. Rectangle is a

A polygon is a shape with multiple sides. Polygon can be of different types: • Triangle is the three- sided polygon. • Rectangle is a four-sided figure. • Pentagon has five-sides • Hexagon has six- sides. Create in Python the parent class (superclass) and subclasses to represent the given problem.
To practice function overloading, overload the calculateArea() function for each of the sub class and calculate area based on the following formulas. You will need to import math to use the square root function math.sqrt().
o Area of a Triangle = (base *height)/0.5
o Area of a Rectangle =(base*height)
o Area of a Pentagon= ((base *height)/0.5) 10
o Area of a Hexagon= ((6 * base * height) + (3 * math.sqrt(3) * base * base))

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

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

In Exercises, find the limit. lim 5 x 0-x 813 X

Answered: 1 week ago

Question

Discuss how investment advisors can help their behavioral clients.

Answered: 1 week ago

Question

What three factors determine cash flows?

Answered: 1 week ago

Question

What are the two items whose sum is the price of equity capital?

Answered: 1 week ago