Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Cookie Monster is friends with many different monsters. The monsters often have fur in all sorts of colors. For this question, you will write a
Cookie Monster is friends with many different monsters. The monsters often have fur in all sorts of colors.
For this question, you will write a program that will let the user explore what Cookie Monster might look
like if his fur was a different color.
The following describes what your program should do in more detail.
Draw a picture of Cookie Monsters face in the middle of the canvas
Initially, Cookie Monsters fur should be blue
Pressing the r key increases the red component of Cookie Monsters fur color by a small amount.
The more the r key is pressed, the redder the fur should become.
Pressing the g key increases the green component of Cookie Monsters fur in the same way.
Clicking the mouse should reset Cookie Monsters fur to its original, pure blue color.
Figure : Cookie Monsters original face, and again after having pressed r and g multiple times.
Recalling the ModelViewController programming style, you will need to think about how to build a
model for this program. What pieces of information will your program need to remember over time? Youll
need a variable for each such piece of information, and these variables ARE your model of the problem. If
a piece of information does NOT change, it does not need to be part of your model. Once youve decided
on your model, you simply have to choose the right interactive functions to put code that will either display
or change the model as appropriate. In particular:
The draw function is your view. Function calls to background and code that draws any portion of
Cookie Monsters face should ONLY go here it is fine to encapsulate the code that draws the face into
its own function, as long as that function is only called in draw
The mouseClicked and keyPressed functions are your controllers. Statements that change the
variables in your model should go here
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started