Java I
Jonah Warrenjonah@parsons.edu
http://a.parsons.edu/~java2004
Lab 3
Complete the following exercises:
- create an array of integers with 50 elements.
- use a for loop to set those 50 elements to the integers 1 through 50.
- alter it so the values in the array are 11 - 60.
- use another for loop and println to print out 11,12,13...60.
- now create a loop that only prints out the even numbers... 12,14,16...60. there are many ways to do this.
Homework 3
(Please email me if you have any questions or problems.)- Read these processing examples about arrays and loops...
- Use for loops to draw patterns with drawing primitives... chose your 2 favorite compositions and post them.
Here is an example... make it nicer than this ugly thing. You can do cool things with color gradients and repetition. Reference the readings you just read.
background(255);
for(int i=0;i<11;i++) {
strokeWeight(2);
stroke(200);
line(0, i*10, 100, i*10);
}
for(int i=0;i<21;i++) {
strokeWeight(1);
stroke(20);
line(i*5, 0, i*5, 100);
}
Better example...
Here is an example with randomly colored rects... try points? lines?
background(255);
noStroke();
for(int i=0;i<100;i++) {
fill((int)random(255), (int)random(255), (int)random(255));
rect((int)random(100), (int)random(100), 10, 10);
}
Better example...
Hint
For the minigame, use millis() to keep track of the time, and width of your timer bar.