During the a coding quiz, you'll solve a programming challenge by writing code in Processing. You will have up to 15 minutes to complete this section. Each student will recieve a different challenge at random.
The next class period will offer a redo opportunity for any students who did poorly on the original. On the redo, you'll be given a random challenge and can complete it for a maximum score of 80%. You will receive the second score, even if it is lower.
The problems below are examples of the kinds of things I might ask you to do on a programming quiz. Your actual question will be very similar, but not identical, to one of these.
These challenges look identical to the last set - that's not a coincidence! The only difference this time is HOW you do it. You MUST use at least one class in your program. You may choose to use either Arrays or ArrayLists, whichever feels most comfortable to you.
Challenge #1
Canvas size: 600 x 600
Background: Orange
100 yellow squares with a randomly assigned size of 5 to 10 pixels that start at a random position on the screen.
Each squares moves to the right side at a speed of 5 pixels per frame.
Each time it reaches the right side of the screen, it appears at a new random position on the left side and increases its size by 40%
Challenge #2
Canvas size: 600 x 600
Background: Blue
200 white circles, each with randomly assigned diameter of between 10 and 20 pixels that starts at a random position on the screen.
Each moves to the top at a speed equal to 20% of their current size in pixels per frame
Each time it reaches the top of the screen, it appears at a new random position on the bottom of the screen.
Challenge #3
Canvas size: 600 x 600
Background: Pink
At the start of the program, 50 red circles are created random positions on the screen. Each has a random size between 10 and 100.
When the user presses the mouse, all circles will change size. Left click will grow the circles, and right click will shrink them. This can be done with either polling or event based methods; choose a rate of change that looks reasonable.
Challenge #4
Canvas Size: 600 x 600
Background: Purple
At the start of the program, 50 yellow rectangles are created across the top of the screen. Each rectangle is 12 pixels wide, 100 pixels tall, and are spaced exactly 12 spaces apart, so that they are touching each other.
Each frame, move all rectangles down by 1 pixel and there is a 10% chance that they reduce their height by 2.
When a rectangle's height is reduced to 0, move it back to the top of the screen and restore its height back to 100.