CS 111 - 2/24/15 Consider the following two loops. How many times does each loop print a value? int i; i = 1; while ( i <= 8 ) { System.out.println (i); i = i + 1; } i = 0; while ( i < 8 ) { System.out.println (i); i = i + 1; } In a picture what is the coordinate value of the upper left hand corner? (0, 0) For a picture that have width of 100 and a height of 200, what is the coordinate value of the lower right hand corner? (100, 200) is not correct ( 99, 199) int x; x = 0; while ( x < p.getWidth() ) { System.out.println (x); x = x + 1; } A Picture is made of pixels (PIcture ELements) Each pixel is at an X,y position the x values run from 0 to (width-1) the y values run from 0 to (height-1) Each pixel has a color Each Color has 3 sub-color amount the red amount the green amount the blue amount The range of color amount for CS 111 will be from 0 to 255 a color amount of 0 indicates none of that color is being used/projected Errors in a program - Syntax Error - normally found by the compiler - Runtime error - the program is not able to run correctly - often a "stack trace" is given that can heelp determine the error - Logic Error - the program runs to completion - however, it did not produce the proper result To fix Error, we have two general steps to do 1. Determine if an error exists - testing our code MAY find these errors 2. Debugging - removing the errors a color amount of 255 indicates that all of that color is being used/projected For an 8-bit value the typical range of value are from 0 to 255 2^8 256 2^24 16 Million of color values 1.67 10 10^7