Question: Write a program that reads a file and displays a histogram to show the occurrences of each letter in the file, as shown in Figure

Write a program that reads a file and displays a histogram to show the occurrences of each letter in the file, as shown in Figure 16.40b. The file name is entered from a text field. Pressing the Enter key on the text field causes the program to start to read and process the file and displays the histogram. The histogram is displayed in the center of the window. Define a class named Histogram that extends Pane. The class contains the property counts that is an array of 26 elements. counts[0] stores the number of A, counts[1] the number of B, and so on. The class also contains a setter method for setting a new counts and displaying the histogram for the new counts.ABCDEFGHIJKLMNOP QRSTUV WX YZ Alename c\book\Welcome.java View (b)

ABCDEFGHIJKLMNOP QRSTUV WX YZ Alename c\book\Welcome.java View (b)

Step by Step Solution

3.45 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Program Plan The program reads the file and displays a histogram to show the occurrences of each let... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!