Question: Question 3 ( 1 0 points ) : Purpose: To practice writing functions with arguments, writing docstrings, and to explore color models. Degree of Difficulty:

Question 3(10 points):
Purpose: To practice writing functions with arguments, writing docstrings, and to explore color models.
Degree of Difficulty: Easy to get the right output, but properly using arguments/parameters can be Tricky.
For this problem, you'll write a program to draw a simple picture of a snowman. It will look something like
this:
Figure 3: A sample snowman with (r. g. b) values of ) for the colour of the snowman's body.
Getting the right visual output for this problem is pretty easy. Our real goal is to practice writing func-
tion definitions and using function calls, arguments, and parameters correctly. For this reason, you are
required to break up your program into the following functions:
draw_body (r,g,b) draws the three "snowballs" that make up the snowman The values r. g. and b
are parameters to this function. Use these parameters to set the main color for the snowman.
draw_buttons (r, g, b) draws 3 buttons on the middle "snowball". The values r. g. and b are param-
eters to this function. Use these parameters to set the color of the snowman's buttons. hint: if you are
having trouble figuring out the coordinates, try using some graphing paper to help plot your drawing.
draw_eyes (x1,y1,x2,y2) draws the eyes for the snowman. The values x1,y1,x2 and y 2 are pa-
rameters to this function. Use these parameters to set the location coordinates for each eye (x1, y1
for the first eye and x2, y2 for the second eye). The eyes may be any colour of your choice.
draw_nose (r, g, b) draws a carrot nose on the snowman. The values r. g. and b are parameters to
this function. Use these parameters to set the colour of the the snowman's nose. hint: Processing
does have a triangle function that may be helpful here!
draw_snowman (r1,g1,b1,r2,g2,b2) makes a function call to all four of the functions above, in
order to draw all parts of the snowman. The values r1,g1, and b 1 are parameters to this function,
representing the snowman's main colour. The values r2, g2, and b2 are parameters to this function.
representing the button colour. This function's parameters should be passed on as arguments to the
other four functions.
Each of the functions above must be documented with a docstring that describes what the function does
and the meaning of its parameters. A small number of single-line comments should also be used where
appropriate throughout the program.
Question 3 ( 1 0 points ) : Purpose: To practice

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!