Question: Question 3 ( 1 0 points ) : Purpose: To practice writing functions with arguments, writing docstrings, and to explore color models. Degree of Difficulty:
Question 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 argumentsparameters 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 : 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:
drawbody 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.
drawbuttons g b draws 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.
draweyes draws the eyes for the snowman. The values and y are pa
rameters to this function. Use these parameters to set the location coordinates for each eye y
for the first eye and x y for the second eye The eyes may be any colour of your choice.
drawnose 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!
drawsnowman makes a function call to all four of the functions above, in
order to draw all parts of the snowman. The values and b are parameters to this function,
representing the snowman's main colour. The values r g and b 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 singleline comments should also be used where
appropriate throughout the program.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
