CS 111 - 4/2/15 Exam 2 during Lecture On Tuesday 4/7/15 20 multiple choice questions 2 write method questions Earn 1% extra credit to overall course grade by writing a sample question in Blackboard Discussion Forum by Sunday, 4/5/15. if ( grayAmount > 191 ) // 192 to 255 ==> cyan { pix.setRed (0); pix.setGreen (255); pix.setBlue (255); } else if ( grayAmount > 127 ) // 128 to 191 ==> green { pix.setRed (0); pix.setGreen (255); pix.setBlue (0); } else if ( grayAmount > 63 ) // 64 to 127 ==> blue { pix.setRed (0); pix.setGreen (0); pix.setBlue (255); } else // 0 to 63 == black { pix.setRed (0); pix.setGreen (0); pix.setBlue (0); } instead of the the above, you would write if ( grayAmount > 191 ) // 192 to 255 ==> cyan { pix.setColor (Color.CYAN); } else if ( grayAmount > 127 ) // 128 to 191 ==> green { pix.setColor (Color.GREEN); } else if ( grayAmount > 63 ) // 64 to 127 ==> blue { pix.setColor (Color.BLUE); } else // 0 to 63 == black { pix.setColor (Color.BLACK); } int z = 0; for (int x = 0; x > -3; x--) { for (int y = 0; y <= 3; y++) { z = x + y + z; if (z < 0) { z = Math.abs(z); } else { z = z; } } } x: 0 -1 -2 -3 y: 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 z: 0 0 1 3 6 5 5 6 8 6 5 5 6 int x = -1; int y = -2; int z = 0; for(i = 0; i <= 4; i++) { for(j = 1; j < 3; j++) { y = y + 2; } z = y + x; } x: -1 y: -2 0 2 4 6 8 z: 0 -1 1 3 5 7 i: 0 1 2 3 4 5 j: 1 2 1 2 1 2 1 2 1 2