import java.io.File; public class CounterTester { public static void main(String args[]) { File inputFile = new File("GettysburgAddress.txt"); Counter counter = new Counter(inputFile); int lineCount = counter.countLines(); System.out.println("Line count: " + lineCount); System.out.println("Expected: 25"); int wordCount = counter.countWords(); System.out.println("Word count: " + wordCount); System.out.println("Expected: 267"); CharacterStats stats = new CharacterStats(); int charCount = counter.countChars(stats); System.out.println("Character count: " + charCount); System.out.println("Expected: 1459"); double digitsPct = stats.getDigitCount()*100.0/charCount; System.out.printf("%% Digits: %5.2f%%\n", digitsPct); System.out.println("Expected: 0.00%"); double lowerPct = stats.getLowerCount()*100.0/charCount; System.out.printf("%% Lower case letters: %5.2f%%\n", lowerPct); System.out.println("Expected: 78.00%"); double upperPct = stats.getUpperCount()*100.0/charCount; System.out.printf("%% Upper case letters: %5.2f%%\n", upperPct); System.out.println("Expected: 0.75%"); double whitePct = stats.getWhiteCount()*100.0/charCount; System.out.printf("%% White space characters: %5.2f%%\n", whitePct); System.out.println("Expected: 18.44%"); double otherPct = stats.getOtherCount()*100.0/charCount; System.out.printf("%% Other characters: %5.2f%%\n", otherPct); System.out.println("Expected: 2.81%"); } }