Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create a superclass Shape with 2 attributes X, Y with a constructor, getters, setters, toString, and 2 abstract methods one is an area, and one

create a superclass Shape with 2 attributes X, Y

with a constructor, getters, setters, toString, and 2 abstract methods one is an area, and one is the circumference

And create 3 subclasses: Square, Rectangle, and Circle

Put the suitable attributes for each class and let each one complete the abstract methods

In the main create an array list of the shapes to contain details about all different shapes.

allow the user to enter the value X for the shapes then print all details of a shape that has its value x equal to the entered value, and for each of them tell if its a square, rectangle, or circle and print its area.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Python Code import math class Shape def initself x y selfx x selfy y def areaself pass def circumferenceself pass def strself return fShapexselfx yselfy class SquareShape def initself x y side superin... 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

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions