[Solved] SOLVED:CS 61002 Algorithms and Programming I

$25

File Name: SOLVED:CS_61002_Algorithms_and_Programming_I.zip
File Size: 414.48 KB

SKU: [Solved] SOLVED:CS 61002 Algorithms and Programming I Category: Tag:
5/5 - (1 vote)

Project 2 Project Objectives This assignment will give you more experience on the use of: 1. classes 2. class methods 3. inheritance In this project, you are going to use turtle graphics to draw one or more snow persons. You will define and use at least 7 classes in doing so. Using instances of these classes, you will write a main() function that creates and draws one or more snow people. Project Specification 1. Define a minimum of 7 classes. Most can be classes for geometric shapes (e.g., Line, Rectangle, Circle, Triangle), but 3 must be drawing-specific classes (see #5). 2. Each class will have at least the following methods: a. __init__: the constructor will take arguments indicating the positions (coordinate pairs, e.g., (0.0, 0.0)) of one or more reference points (e.g., start and end points for a line, vertices for a triangle, etc); and other arguments appropriate for an instance (e.g., pen color, fill color, etc.). To simplify creating instances, it will define appropriate default values for most of the arguments. (If the argument for fill color is the empty string (), the shape is not filled.) b. __str__ : a conversion method, it returns the string to be used for printing an instance in Python. c. draw : the draw method will take a turtle.Turtle object to use for drawing the shape. d. Other arguments may be required for your methods; all arguments will be described in your docstrings. 3. All classes, methods and functions require a docstring for a general description of the object/method/function. 4. Define a main function that is called without any arguments. Your main function should create and draw one or more snow people at different positions on the canvas. 5. Define a drawing-specific class hierarchy containing (at least) 3 classes: a. Snow_person : an instance contains (at least) the 3 snowballs b. Snow_man : specializes a Snow_person with a handful of additional components (e.g., arms, buttons, head wear) CS 61002 Algorithms and Programming I c. Snow_lady : specializes a Snow_person with an alternate set of additional components. 6. At a minimum, a snow person should include three snowballs, drawn one on top of the other, and two eyes and a mouth. Feel free to personalize your classes to include other components. Project2 Notes: The idea is to make classes for geometric objects that you will need in drawing snow people. These objects store information about how they are to be drawn (position, pen and fill color, and such). Invoking the draw function on an object draws it on the canvas at the indicated position and using the indicated colors. The snow person classes are for making instances of snow people. An instance stores instances of the components (geometric objects) that make up an individual snow person. When creating an instance, you must supply a reference point (coordinate position). You will need to layout the positions for the components relative to this reference point. As an example of this style of class definition, we supply sample10.py. Study this example. Be sure you understand it before proceeding to write your solution. You can use the definitions for the Shape and Line classes in your program (not a requirement). If you do, these count as just one class definition you will need to write at least another 6 classes. The screen shot below was created by a program that meets the specifications for this project. It shows an instance of a Snow_man class (left) and an instance of a Snow_lady class (right).

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:CS 61002 Algorithms and Programming I
$25