Question: Description: Frequency Distribution Program Write a program driver that will use your FileCopier class to process an input file and determine the frequency distribution for
Description: Frequency Distribution Program Write a program driver that will use your FileCopier class to process an input file and determine the frequency distribution for the length of words in the file. For our purpose a word is defined as 1 or more alphanumeric characters. The length of the word will not exceed 78 characters in length. Output to the screen should consist only of a summary of the distribution list, output to the file should also only be the summary information of the frequency distribution list.
Code your algorithm for your solution to include the following:
Prompt and accept the names of the input and output files.
When printing the summary, only print results for lengths of words totals that are greater than zero.
Example:
1 character words = 13
2 character words = 21
3 character words = 7
4 character words = 14
5 character words = 5
6 character words = 6
7 character words = 1
10 character words = 3
Use good use of whitespace, and internal documentation.
Save the driver program as freqdist.java, and modify your FileCopier class by adding a freqDistCalc( ) method, and a freqDistPrint( ) method. Note: freqDistCalc ( ) will be similar to your vowel counting method, but will not actually copy the input file. It will only process the characters in the input file.
THIS IS WHAT I HAVE DONE SO FAR, but the programm needs to use the specified methods above, and take input from user, which I haven't been able to implement:
package freqdist; import java.io.FileInputStream; import java.io.IOException; import java.util.*;
/** * * @author gastonseneza */ public class Freqdist {
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { // TODO code application logic here //Create inout stream & scanner FileInputStream fin = new FileInputStream("readwords.txt"); Scanner fileInput = new Scanner(fin); //Create the ArrayLists ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
