Question
This assignment will give you more experience on the use of: 1. classes 2. class methods In this project, we are going to use a
This assignment will give you more experience on the use of:
1. classes 2. class methods
In this project, we are going to use a library package called turtle graphics to draw a car. We are going to create at least 5 classes. We are then going to write a function that creates instances of your classes in order to draw a car that includes: a body, wheels, windows, and an antenna. You can certainly provide more than 5 (taillights, headlights, windshield, wipers, grill, etc.), but 5 is a minimum.
Project Description / Specification Define 5 classes (at least).
1. Each class will have an __init__ and a draw() method: a. the __init__ method will take a string argument, either indicating a fill color or, if the argument is (the empty string), that the shape is not filled. b. the draw method will take at least x and y coordinates arguments (indicating where the figure is drawn) and a turtle.Turtle object to use for drawing the shape. c. Other arguments may be required for your methods; all arguments must be described in your docstrings.
2. Function car(pen, bodycolor) where pen is a turtle.Turtle object with which to draw the car and body color is the color of the car. Note: this function will be used by the grader to test your code so it is critical that it meets this specification.
3. Your car must, at a minimum, include the following classes: a. a body b. wheels c. windows d. an antenna e. at least one other (of your own design)
4. All classes, methods and functions require a docstring for a general description of the object/method/function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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