========================= QUICK EXERCISE: compound statement without braces .............................................. indentation is for humans! ========================= DEMO: TimePrinter > TimePrinter.toString( 100 ) "1 minutes 40 seconds" > TimePrinter.toString( 10000 ) "2 hours 46 minutes 40 seconds" > TimePrinter.toString( 1000000 ) "11 days 13 hours 46 minutes 40 seconds" > TimePrinter.toString( 1000000000000 ) NumberFormatException: For input string: "1000000000000" at java.lang.NumberFormatException.forInputString (NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:459) at java.lang.Integer.valueOf(Integer.java:553) ............................... so, use doubles, with scientific notation > TimePrinter.toStringFromDouble( 1000000000000.0 ) "31688 years 1 months 1 days 15 hours 46 minutes 41.0 seconds" ========================= NEXT EXERCISE: for-loop with different ctrl values int[] mileage = { 3, 5, 8, 5, 8, 0, 12, 3, 6, 8, 5, 8, 0, 14, 3, 6, 8, 6, 8, 0, 16, 3, 7, 8, 5, 9, 0, 12, 3, 7, 8, 6, 9, 0, 18, 0, 7, 8, 6, 9, 0, 20 }; int sum = 0; for (int i = 6; i < mileage.length; i = i + 7) sum = sum + mileage[i]; System.out.println( sum ); // ---> 92 ............................... what if... - I wanted to know the mileage I ran on Wednesdays? - I wanted to know my mileage every other day? - I wanted to count the Sundays I ran more than 12 miles? ========================= NEXT EXERCISE: creating blank Sudoku grids Picture p = new Picture(); p = p.makeSudokuGrid(); p.show(); // p.write( "/Users/wallingf/Desktop/blank-grid.jpg" ); ............................... what if... - I want a grid of a different size? - make width a parameter - convert constants into computed values! ========================= LAST EXERCISE: design solution to Homework 4