Midterm exam 1 review Fall2006: Tracing Complex Picture Method
Back to Midterm Exam 1 Review Fall2006
Questions? Answers? Comments?
(a) (200,250,5)
Sol: (200,231,5)
(b) (128,36,100)
Sol: (128,64,100)
(c) (15,35,200)
Sol: (15,53,200)
(d) (125,100,150)
Sol: (125,125,150)
REMOVED Cormack
checked it! should be no mistake!
the two if statement is a lil bit tricky though!
Chris Angkasa
How do we get 53 for solution no (c) because value = pixel.getRed()-pixel.getBlue(); = 12-200 = -185. therefore, we have to go with the first if condition. if (value 0) { value = -value;}: which means value = 185. the second for loop j value should be j 185. that means for loop for 185 times. How is it possible to get 53 for the green color?
Denis
Hey Denis: Chris Angkasa was right, the two if statements is a lil bit tricky. Be sure to know the difference between if-if and if-if else (Joel)
It goes through the first if statement and makes it 185. Then it goes to the next if statement, and because it is greater than 150 it divides by 10, giving you 18. You then add 18 to 35, giving you 53. Hope this helps.
REMOVED
Thanks REMOVED
Denis
Link to this Page