Class Shape Constructor has 4 parameters and 4 attributes to be listed in this order: numSides, shapeName, nameAnchor, and messageAnchor. All four attributes should be private. Methods: displayName and displayNumSides both accept a window object as a parameter. Each should create and draw a Text object from the graphics library to display the appropriate information. nameAnchor is the point at which the name will be displayed and messageAnchor is where the message will be displayed. Class Square, Ball¹, Triangle, and Octagon Constructors should accept 2 parameters for the nameAnchor, and messageAnchor. It will call the super class constructor and pass in the correct number of sides and name for the shape, as well as the name and message anchor passed by parameter Each class should aslo have a drawShape method that accepts a window object as a parameter. It will then build the appropriate shape from the graphics library and draw it appropriately.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

this is given code

ShapeLab.py


# create classes here and their methods

 

 


def main():
    win = GraphWin("Shape Test", 600, 600)
    l1 = Line(Point(300, 0), Point(300, 600))
    l2 = Line(Point(0, 300), Point(600, 300))
    l1.draw(win)
    l2.draw(win)

    shapes = []
    shapes.append(Square(Point(50, 20), Point(100, 280)))
    # shapes.append(Ball(Point(350, 20), Point(400, 280)))  # remove comment to test Ball
    # shapes.append(Triangle(Point(50, 320), Point(100, 570)))  # remove comment to test Triangle
    # shapes.append(Octagon(Point(350, 320), Point(400, 570)))  # remove comment to test Octagon

    for shape in shapes:
        shape.displayName(win)
        shape.displayNumSides(win)
        shape.drawShape(win)


    win.getMouse()
    win.close()


if __name__ == '__main__':
    main()

 

in python please

 

 

 

You will be writing 5 classes for this assignment, a superclass called Shape, and 4 subclasses:
Square, Ball, Triangle, Octagon.
Class Shape
Constructor has 4 parameters and 4 attributes to be listed in this order: numSides, shapeName,
nameAnchor, and messageAnchor. All four attributes should be private.
Methods: displayName and displayNumSides both accept a window object as a parameter. Each
should create and draw a Text object from the graphics library to display the appropriate information.
nameAnchor is the point at which the name will be displayed and messageAnchor is where the
message will be displayed.
Class Square, Ball¹, Triangle, and Octagon
Constructors should accept 2 parameters for the nameAnchor, and messageAnchor. It will call the
super class constructor and pass in the correct number of sides and name for the shape, as well as
the name and message anchor passed by parameter
Each class should aslo have a drawShape method that accepts a window object as a parameter. It
will then build the appropriate shape from the graphics library and draw it appropriately.
Shape Test
Square
A Square has 4 sides
Triangle
A Triangle has 3 sides
Circle
A Circle has 0 sides
Octagon
A Octagon has 8 sides
Transcribed Image Text:You will be writing 5 classes for this assignment, a superclass called Shape, and 4 subclasses: Square, Ball, Triangle, Octagon. Class Shape Constructor has 4 parameters and 4 attributes to be listed in this order: numSides, shapeName, nameAnchor, and messageAnchor. All four attributes should be private. Methods: displayName and displayNumSides both accept a window object as a parameter. Each should create and draw a Text object from the graphics library to display the appropriate information. nameAnchor is the point at which the name will be displayed and messageAnchor is where the message will be displayed. Class Square, Ball¹, Triangle, and Octagon Constructors should accept 2 parameters for the nameAnchor, and messageAnchor. It will call the super class constructor and pass in the correct number of sides and name for the shape, as well as the name and message anchor passed by parameter Each class should aslo have a drawShape method that accepts a window object as a parameter. It will then build the appropriate shape from the graphics library and draw it appropriately. Shape Test Square A Square has 4 sides Triangle A Triangle has 3 sides Circle A Circle has 0 sides Octagon A Octagon has 8 sides
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education