Create an array of floating point numbers called gpas and insert the following values: 3.2, 4.0, 1.6, 2.7, and 3.0. Also create a 500 x 500 pixel drawing canvas with a white background.

ASSIGNMENT

For each question, submit a .pde (Processing) file. The name of the file should be yourname_finalexam_x.pde, where x indicates the number of the question. For example, if your instructor were to submit a result for question 1, the file would be named: caseyblamires_finalexam_1.pde

Question 15 points

Convert the following “for” loop into a “while” loop that does the same thing:

for( int i = 10; i >= 0; i=i-1 ) {

println( i );

}

Question 25 points

Convert the following “while” loop into a “for” loop that does the same thing:

int i = 0;

while( i < 100 ){

println( “This is the “ , i , “ count in the loop” );

i = i+1;

}

Question 310 points

Create an array of floating point numbers called gpas and insert the following values: 3.2, 4.0, 1.6, 2.7, and 3.0

Create an array of Strings called names and insert the following values: Cindy, Ava, Blake, Bobby, and Craig

Create an array of booleans called passing and insert the following values: true, true, false, true, and true

Create a loop that prints the data from the tree arrays in the following format:

Name: Cindy; GPA: 3.2; Passing: true

Question 45 points

Create a 500 x 500 pixel drawing canvas with a white background. If the mouse is clicked in the upper left quadrant, change the background of the canvas to red. If the mouse is clicked in the upper right quadrant, change the background of the canvas to blue. If the mouse is clicked in the lower left quadrant, change the background of the canvas to yellow. If the mouse is clicked in the lower right quadrant, change the background of the canvas to purple.

Question 510 points

Create a 1000 x 1000 pixel drawing canvas. Draw a house according to these specifications:

The house must be a blue square

The roof must be a black triangle

The door must be a yellow rectangle

There must be two windows on either side of the door that are white circles

Question 610 points

Create an integer variable called totalPoints. Set it to 83.

Create an integer variable called finalExamScore. Set it to 70.

Write a program that will print “You passed!” if the totalPoints is greater than or equal to 70 and the finalExamScore is greater than or equal to 70. If the totalPoints is greater than or equal to 70 but the finalExamScore is less than 70, print “Your final exam grade was below a C.”

If the totalPoints is less than 70, but the finalExamScore is greater than or equal to 70, print

“Your total points grade was below a C.” If both variables are less than 70, print “Your course grade was below a C.”

Question 710 points

Write a loop that starts at 10 and goes up to and including 20, incrementing by 2. Each time through the loop, check to see if i is less than 15.

The loop should be constructed to print the following:

The number is 10, which is lower than 15

The number is 12, which is lower than 15

The number is 14, which is lower than 15

The number is 16, which is higher than 15

Etc…

Question 85 points

Create a floating point variable B and set its value to 4.3.

Create an integer variable and set its value to 2.

Write a program that calculates V using the formula V = B * A + 13

Your program should print the result of V.

Question 95 points

Write a loop to print all of the odd numbers from 1 up to and including 111 each on their own line.

 

Create an array of floating point numbers called gpas and insert the following values: 3.2, 4.0, 1.6, 2.7, and 3.0. Also create a 500 x 500 pixel drawing canvas with a white background.
Scroll to top