Question: Getting the right visual output for this problem is pretty easy. Our real goal is to practice writing function definitions and using function calls and
Getting the right visual output for this problem is pretty easy. Our real goal is to practice writing function
definitions and using function calls and function arguments and parameters correctly. For this reason, you
are required to break up your program into the following functions:
drawbodyr g b draws the body of the car, including the front window. The values r g and b are
parameters to this function. Use these parameters to set the color of the cars body. The color of the
window however should always be blue.
drawwheelx y draws just one wheel of the car. A wheel consists of a black outer tire and a white
hubcap. The values x and y are parameters to this function that indicate the x y location coordinates
of the center of the wheel
drawcarr g b draws the entire car by making function calls to the functions above. The values
r g and b represent the color components of the cars body; these should be pased along as arguments to the drawbody function. Note that drawwheel will have to be called twice with different
arguments to draw both wheels!
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.
The very last line of your program should be a function call to drawcar where the colour values for
the cars body are passed in as arguments. For example, a call of drawcar should produce
the car seen in the sample here, whereas a call of drawcar would produce a black car. This
should be the ONLY place in your code where you specify actual numbers for the color of the car.
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
