========================= OPENING EXERCISE: two unique rolls > Die d = new Die( 6 ); > d.uniqueRolls(); Rolls: 2 5 ========================= IMPROVING SOLUTION: _n_ unique rolls > java Die // with powerball commented out ========================= SLIDES: Where Were We? ----- AFTER "HOW TO WRITE A FILE" SLIDE > import java.io.*; > BufferedWriter file = new BufferedWriter( new FileWriter("output.txt") ); > file.write( "foo" ); > file.newLine(); > file.write( "bar" ); > file.newLine(); > file.close(); ----- Open output.txt in Finder. ----- (in dir with Dr. Java) ----- Then use a complete path in code ----- to specify particular location. ========================= TASK: add a write() method to DiffSound ----- write first sample ----- write # of diffs ----- write each diff ----- Complications: ----- ... I/O exception ----- ... files of characters > Sound s = new Sound( FileChooser.getMediaPath("ew/the-voice-raw.aiff") ); > DiffSound d = s.compress(); > d.write( "ew/the-voice-raw.diff" ); ----- Open the file. See the data. ----- But the file is **bigger** ----- Finish task with slides. ========================= QUICK EXERCISE: mirroring a String String source = "Eugene Wallingford is the finest CS I instructor I know."; for ( int i = source.length(); i > 0; i-- ) System.out.print( source.charAt(i-1) ); System.out.println();