0% found this document useful (0 votes)
18 views

2.3 - Activity 1

Uploaded by

Raghav Amiish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

2.3 - Activity 1

Uploaded by

Raghav Amiish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

RIT-Dubai

Fall 2023
GCIS-123
Class Activity & Problem Solving #01
Turtle Scenery
Rubrics
 15%: Problem-solving.
 25%: Design:
– Implements functions for drawing the scene elements with parameters
– Properly passes arguments for drawing table, cake, and candle functions.
– Asks parameters to the user to customize the drawings.
 50%: Functionality:
– 35%: Draws a scene with at least 1 candle, 1 table, 1 cake, and 1 decoration.
– Hard-coding the values is prohibited; the code must use function return values.
– 5%: Drawing fits within the canvas window without cutoff.
– 5%: Fills shapes with colors, and border lines match fill colors.
– 5%: Displays the drawing for the user to view before exiting the program.
 10%: Style and Documentation: The code must follow the style guidelines. For example, the
code should be commented; there should be a file docstring as well as function docstrings.
 Off-the-top Deductions
– 50%: The program is one long function that draws the entire scene.
– 20%: Failure to follow submission requirements may include up to 10%: for incorrect file
names or use of zip, and 10%: for incorrect use of Python version 2 instead of version 3.
Submission
1. Save with the appropriate internal documentation (i.e. comments & docstring) as
scenery.py;
2. Upload scenery.py to BOTH the MyCourses Assignment box and GitHub classroom. Only
if you got errors over the type of file you can submit a zipped version (zip format)

1
1. Problem
This activity involves writing functions that use Python Turtle commands to draw pictures and
requires an understanding of fundamental program mechanisms, including Program Behavior.
The goal of this assignment is to use Python’s turtle graphics module, to design a program that
draws a birthday cake on a table.

2. Descriptions
You are asked to develop a Python program to draw a birthday cake with a candle on a table.
The layout is your decision.
The program will interact with the user. It will ask the user the color, size of the table, and size of
the cake. It will draw a table of the given size and color. The cake should be placed on the table
with a candle on it.
You may embellish and expand to draw more decorations on the cake as desired (see the
picture below).

The program must pause after drawing the figures and wait for the user to close the drawing
canvas window.
Example terminal output:
Please enter the length of one side of a table (between 10-100): 39
Please enter the color of the table: White
Please enter the size of the cake (between 10-100) Note that the cake
size should be equal to or smaller than the table size: 10
Your cake is loading! Happy Birthday!
Press any key to exit …

2
3. Problem-solving Session (15%)
Work in a team of 3 students. You need to continue working after the class with your
teammates to finish all requirements. Below is a list that will help you determine what you will
need to do on your own. Tasks:
• Create the file scenery.py for your solution. (5%)
• Write docstrings for the file. (5%)
• Write functions for each part as you develop it. (5%)
During problem-solving, do not worry about filling figures with color.
1. Write a Python function to draw a square/rectangle table, and use parameters to
specify the side length and color. The turtle must end in the same location and orientation
in which it started.
2. Write a Python function to draw a cake, and use parameters to specify the radius. The
turtle must end in the same location and orientation in which it started.
3. Write a Python function to draw a candle on the cake.
4. Write a main function and reuse the functions created in the first 3 tasks. The turtle must
end in the same location and orientation in which it started.

4. Implementation (85%)
Each Group will submit their own solution to the problem as a Python program named scenery.py.

1.1 Functional Requirements and Constraints


The following provides additional details on the functional behavior of the program:
1. Draw 1 table with:
 4 legs
 Filled with a color
 Either square or rectangular shape
2. Draw a birthday cake.
 At least 1 decoration on it (star, ball shape, sparkles…)
3. The program must pause after drawing the figures and printing the area, inform the user to
close the drawing canvas window in order to quit, and wait for the user to close the
drawing canvas window.
4. The program should use a canvas size appropriate for your drawing, and the figures should
not extend beyond the edges of the canvas. The canvas window must fit on a typical
computer display monitor.

1.2 Code Requirements and Constraints


The program code must include the following:
3
1. Reusable functions. Functions should be used more than once to simplify the
implementation of various components. Functions to draw rectangles and circles come to
mind as useful.
2. A table drawing function. This function with one or more parameters should be able to
draw different tables with the same or different characteristics. Color, width, and height
parameters will allow the function to draw different facades.
3. A cake drawing function. This function should take parameters (such as size or any
other input from the user) that enable it to draw a cake with at least 1 decoration and a
candle on it.
4. If you want to resize the canvas or move the origin to better fit on the image, you can
use screensize and setworldcoordinates functions to manage canvas size and adjust
the coordinate system.

You might also like