Question
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started