Please complete this homework before next class. I will be posting the
solutions by wednesday.
If you get stuck, please do these things (in this order) :
1. Review the slides. Check out the code examples.
2. Review processing.org's reference page.
3. Look for code examples online (EX : try googling "Java if statement")
4. If you're still stuck, email me with the problem you're having :)
If you email me, include your name and what class you're in please.
Everyone should do the easy problems and the medium problems.
If you can't solve the hard problems, that's ok. I don't expect that
many of you
are able to solve them.
If you are able to solve the really hard problems, send me your solution!
I will be so proud and it would be cool to see how you did it :)
These problems should be on the easier side.
1. Write code that prints "Hello world!" only if x is greater than 0
2. Write code that checks if age is greater than 10. If true, print "Hi!"
If not, print "Goodbye!"
3. Write code that checks if the variable passcode is equal to 100. If it is,
print passcode. Otherwise, print "Go away."
4. Create a variable x that equals 29183 and a variable y that equals 1956.
Write code that multiplies x times y and prints the result.
These problems are a little bit harder, but you should still be ok doing them
1. Write a program that draws circles at the mouse's position. But only when
the user is pressing a button
2. Write a program that prints every number between 1 and 9999.
5. Write a function called "printTwice()" that prints the string that you give it
twice. You should be able to use it like this :
printTwice("Hello");
And it should print
HelloHello
6. Write a function that draws a blue circle on the screen. It should be called
drawBlueCircle(). The function should work if you use it like this :
drawBlueCircle()
7. Write a program that draws circles at the mouse position. Now make it so
that the color of the circle changes over time. This one is hard,
it will require some creative problem solving.
These problems are hard. If you can do these then you're doing great. (Solving these may require googling!)
1. Write a program that prints all the even numbers between 0 and 9999
2. Write a program where you can draw circles on the screen at the mouse position.
Next, make it so that the color of the circles can be changed by pressing a button.
3. Write a program where there is a circle in the center of the screen. Make it so
that you can move
it by pressing W, A, S, D. W should move the circle up,
D should move the circle right. S should move the circle down.
And A should move the circle right.
BONUS :
If you can, you should make try to make a simple game and bring it into next
class. I haven't taught you how to make games yet but everyone in the class
has everything they need to start making a game! If you bring in a game you
will get cookies and I will show your game to the class.