/* INPUT FILE, midterm_scores.txt: 40 95 55 40 93 55 87 40 93 40 ... EXPECTED OUTPUT: 40: **** 55: ** 87: * 93: ** 95: * */ import java.io.*; public class Histogram { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("midterm_scores.txt")); int[] tally = new int[101]; while (input.hasNextInt()) { int score = input.nextInt(); tally[score]++; } for (int i = 0; i < tally.length; i++) { if (tally[i] != 0) { System.out.print(i + ": "); for (int j = 0; j < tally[i]; j++) { System.out.print("*"); } System.out.println(); } } } }