CS 101 - 4/17/12 Exam 2 Results Count: 73 Max: 98 Min: 20 Ave: 61.93 Median: 64 St.Dev: 20.09 90's: 8 80's: 7 70's: 15 60's: 12 50's: 9 40's: 12 30's: 5 20's: 5 ============================ Lab 13 pos: 0 1 2 3 4 5 6 7 8 9 10 bgp: 0 1 2 3 0 1 2 3 0 1 2 fg: 12 24 48 82 75 53 32 39 67 92 52 bg: 6 9 3 6 rs: 14 27 49 84 SoundSample[] fg = foregroundSound.getSamples(); SoundSample[] bg = backgroundSound.getSamples(); // version 1 bgp = pos; while ( bgp >= bg.length ) { bgp = bgp - bg.length ; } bgAmplitude = bg[bgp].getValue(); //version 2 bgp = pos; bgp = bgp % bg.length ; bgAmplitude = bg[bgp].getValue(); ============================= Project 4: Extraction extract the least significant decimal digit from each amplitude value (the one's place) combine 3 digits into a ascii number convert ascii number to an ascii character join the ascii characters into a string digit0 = 7 digit1 = 1 digit2 = 1 asciiNumber = digit2*100 + digit1 * 10 + digit0 * 1 = digit2 * 10^2 + digit1 * 10^1 + digit0 * 10^0 = digit2 * Math.exp(10, 2) + digit1 * Math.exp(10, 1) + digit0 * Math.exp(10, 0) int asciiNumber = 117 char asciiChar; asciiChar = (char) asciiNumber;