Write a program in Python that prompts the user for information (radius, side, height, width, etc) about at least three geometry shapes.

Write a program in Python that prompts the user for information (radius, side, height, width, etc) about at least three geometry shapes.

Possible geometry shapes: circle, ellipse, rectangle, square, equilateral triangle, right triangle, isosceles triangle, triangle, parallelogram, rhombus and trapezoid.

Use the information to:

– calculate the areas of these shapes;

– print the areas;

– print the sum of the areas;

– print the average of the areas;

– print the larger of the areas;

– print the smaller of the areas.

Hint: Python defines max and min functions that accept a sequence of values, each separated with comma.

Show the results on screen.

Remember: the user will only see what is on screen not what is inside the code. So, use clear and explanatory information.

For the coding, use:

– in-program comments

– logic

– accuracy

– efficiency

Expert Answer

 Python Program:

class Circle:
“””
Circle Class
“””

def __init__(self, r=0):
“””
Constructor that initializes radius
“””
self.radius = r;

def area(self):
“””
Function that calculates area of circle
“””
return 3.14 * self.radius * self.radius;

class Square:
“””
Square Class
“””

def __init__(self, s=0):
“””
Constructor that initializes side
“””
self.side = s;

def area(self):
“””
Function that calculates area of square
“””
return self.side * self.side;

class Rectangle:
“””
Rectangle Class
“””

def __init__(self, w=0, h=0):
“””
Constructor that initializes width and height
“””
self.width = w;
self.height = h;

def area(self):
“””
Function that calculates area of rectangle
“””
return self.width * self.height;

def main():
“””
Main Function
“””

# Reading circle data
radius = float(input(“n Enter radius of a circle: “));

# Creating Circle Class object
circleObj = Circle(radius);

# Getting area of circle
circleArea = circleObj.area();

# Reading square side
side = float(input(“nn Enter square side: “));

# Creating Square Class object
squareObj = Square(side);

# Getting area of square
squareArea = squareObj.area();

# Reading rectangle data
width = float(input(“nn Enter Rectangle width: “));
height = float(input(“nn Enter Rectangle height: “));

# Creating Rectangle Class object
rectangleObj = Rectangle(width, height);

# Getting area of rectangle
rectangleArea = rectangleObj.area();

# Storing all Areas in to a list
areas = [circleArea, squareArea, rectangleArea];

# Printing areas
print(“nnnn Circle Area: %.2f ” %(circleArea));
print(“nn Rectangle Area: %.2f ” %(rectangleArea));
print(“nn Square Area: %.2f ” %(squareArea));

# Printing results
print(“nn Sum Of areas: %.2f ” %(sum(areas)));
print(“nn Average Of areas: %.2f ” %(sum(areas)/float(len(areas))));
print(“nn Larger area: %.2f ” %(max(areas)));
print(“nn Smaller area: %.2f nn” %(min(areas)));

# Calling main function
main();

______________________________________________________________________________________________

Sample Output:

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?