What are two variables commonly used in our class?
x and y
Complete the if statement:
If you complete all your work, and attend all your classes, then ....
answers may vary
rect is the code used to create what shape?
rectangle
What is the index of the starting value in an array always?
0
When the number of times to loops is unknown, what type of loop do we use?
What is while loops?
Which line of code shows the variable declaration? (slide 7)
What is an if statement in computer science?
It is code that tells the program to run under certain conditions. "if this.. then that"
From looking at the below code, Walk us through what each parameter value represents.
rect(20,25,70,40);
20-x coordinate
25-y coordinate
70-width
40-height
Find the two errors in this array code. (slide 12)
there is a missing quotation mark after bananas, all the y values are the same
What situations are for loops used in?
When the number of times to loop is known (Repeat 'x' times)
What is a reasonable variable declaration for this while loop? (slide 8)
var y=0
Fill in the blanks
if (y ){
yspeed=2;
}
(slide 15)
if (y<100){
yspeed=2;
}
Write the code for the ellipse seen here (slide 9).
ellipse(100,100,50,75);
What is the line of code that would access Zamani from the below array of teachers?
var scienceTeachers= ["Negassi", "Smith", "Dassler","Zamani", "Hasan"];
scienceTeachers[3]
What are the parameters for the ellipse in the while loop? (slide 5)
x,350,25,25
Where and when do we use variable declarations (that you've learned in this class)?
Loops, Animations, functions & anywhere that lines of code are being repeated
Fill in the blank for a bottom ball bounce ( slide 16)
if ( ){
yspeed = - 2;
}
if (y > 300){
yspeed = - 2;
}
Write the code for the rectangle seen here including the code for its color. (slide 9).
fill(255, 0, 0);
rect(150,200,100,100,30);
Identify three major issues in this array code (slide 13).
-the fill function is missing thus the text will not show up
-all of the index values are 0
-there is a missing semicolon; after the bottom text line
What is the syntax for creating repeating images such as the grass below? (slide 6)
var grass = getImage("cute/GrassBlock");
var x = 0;
while (x <= 400){
// Draw the grass once
image(grass, x, 270);
x+=100;
}
What parameters do we use for x and y, to make the mouse interactive?
mouseX, mouseY
What is the if statement for the below ball bounce? (slide 14)
if(x<100){xSpeed=2;}
Write the code for the triangle seen here. (slide 11)
fill(255, 0, 0);
triangle(200,100,100,250,300,250);
Write the expression that we would use to count up how many values are in an array of video games?
videoGames.length