Answered step by step
Verified Expert Solution
Link Copied!

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

Cookie Monster is friends with many different monsters. The monsters often have fur in all sorts of colors.

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 Monster's face in the middle of the canvas Initially. Cookie Monster's fur should be blue Pressing the 'r' key increases the red component of Cookie Monster's 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 Monster's fur in the same way. . Clicking the mouse should reset Cookie Monster's fur to its original, pure blue color. Figure 2: Cookie Monster's original face, and again after having pressed 'r' and 'g' multiple times Recalling the Model-View-Controller 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? You'll 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 you've 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 Monster's 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

3.43 Rating (162 Votes )

There are 3 Steps involved in it

Step: 1

It seems you are looking for guidance on how to create an interactive program that adjusts the color of Cookie Monsters fur based on key presses follo... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microeconomics An Intuitive Approach with Calculus

Authors: Thomas Nechyba

1st edition

538453257, 978-0538453257

More Books

Students also viewed these Programming questions