You are working on a graphical app, which includes multiple different shapes. The given code declares a base Shape class with an abstract area() method and a width attribute. You need to create two Shape subclasses, Square and Circle, which initialize the width attribute using their constructor, and define their area() methods. The area() for the Square class should output the area of the square (the square of the width), while for the Circle, it should output the area of the given circle (PIwidthwidth). The code in main creates two objects with the given user input and calls the area() methods.
dengindkn / shapes Goto Github PK
View Code? Open in Web Editor NEWSolution for Shape question in SoloLearn