Question: Figure 1 : Small circle starts in the middle ( left ) ; triples in size when 3 is pressed ( middle ) and then
Figure : Small circle starts in the middle left; triples in size when is pressed middle and then moves and resets to original size when mouse is clicked, then doubles in size when is pressed.
Heres a description of how to go about your work Step
Define a function called calculatesize This function should have two input parameters: the old diam eter of the circle an integer and the digit key that was pressed on the keyboard a string The function should first convert the digit from a string to an integer hint: use the int function to do this and then multiply it with the old diameter and return the result. This isnt a lot of work for the function to do in fact, it might just be line of code but the point is to practice using parameters and return values. Importantly, the function should not use global variables in any way.
Step
Once you are sure your function from step is working, you can add the interactive parts of your program. Make sure to use a good ModelViewController design and decide what your global variables will be then add your setup draw mouseClicked and keyPressed functions. Call your calculatesize func tion in the right place when you need to change the size of the circle hint: this will only be in keyPressed
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
