Question: 1 Description of the Program In this assignment, you will write a Java program that counts the 26 letter frequencies for a given string. You

 1 Description of the Program In this assignment, you will write

a Java program that counts the 26 letter frequencies for a given

string. You may name your Java file name as LetterCounter ArrayApp.java, and

1 Description of the Program In this assignment, you will write a Java program that counts the 26 letter frequencies for a given string. You may name your Java file name as LetterCounter ArrayApp.java, and write methods that use arrays to store the frequencies. The detailed descriptions are as follows: Method 1: countLetters() /* * Return an array of 26 letters frequencies for a given string * * Note: You only need count the frequency for 26 letters * i.e., "abcdefghijklmnopqrstuvwxyz". * you should count both uppercase and lower case letters */ public static int [] countLetters(String str) { // your work } Method 2: printLetterFreq() /* * Print the letters, their frequencies, and frequency representations * @countArray: an array of 26 letters frequencies in an alphabetic order * * Note: Only print those frequencies > 0. */ public static void printLetterFreq(int [] countArray) { // your work } 1 Method 3: numToStar(int num) /* * Return a string with a number of stars (*) corresponding to the input * "num", For instance, if num = 5, then you should return "*****" * * Note: This method will be invoked in the method of printLetterFreq() */ public static String numToStar(int num) { // your work here } Method 4: mostFreqLetter(). /* * Find the most frequent letter in all 26 letter frequencies. * @countArray: an array of 26 letters frequencies in an alphabetic order * * Note: If there are more than one letters with highest frequencies, * then return the first most frequent letter. */ public static char mostFreqLetter(int [] countArray) { // your work here } In your main() method, you apply these methods on each of four strings stored in a file inputstring.txt, and display the letter frequencies for each string(See a sample screenshot of the first input string). Particularly, you should do the following Declare a string variable, and initialize it using the first string in inputstring.txt; Compute the 26 letter frequencies using the method of counteLetters(); Display the 26 letter frequencies using the method of printLetterFreq(); Display the most frequent letter using the method of mostFreqLetter(); Repeat the above steps on the second, third and fourth string from the input file. Additional requirements of your program: 2 1. Your program ouputs should be neat (See the screenshot of the first as shown in Figure 1). 2. Your program should have good style (indentation, whitespace, comments, vertical alignment, ...). Figure 1: The screenshot of letter frequencies for the first string

CPSC 131: Introduction to Computer Progra II Program 1: LetterCount Using Arrays Due by Septeber 18, 2018 1 Description of the Program a given strYou y e your Java tile nae as LetterCounter hrray pp.java, and write netbods that aTays to store the frequencics. The detailod desctiptios are a fraqiianCAS far given tring You onl noad coant tha frequency tor 2E letters you chould count toth uppercace and loncr casc letterc public atatic int cauntLattars(string atr) your ork * Print telttara, thair fraquencias, and fraquancy TAprAsantationa 4 DcoantArray: an array of 261tLra frequencina in n alphabetie order Note: ly print theae traquanciaa > public statie void prinit rray) 1 your sork E O lype here to search

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!