Question Solved1 Answer intro java No global variable ,Get data from input , print to ouputFile extra credit one also pls Homework - Topic 8 - Word Count: Write a program that reads in and prints a text, line by line, and calls a series of methods as needed. The object of the program is to parse a sentence in order to figure out all the different words that are in the sentence and how many times each word occurs. Use two parallel arrays, one to store the different words (e.g., String[] word) and one to store the appearance count for each word (e.g., int[] wordCount). At the end, print the list of different words and their counts. (Extra Credit: print the list of words and their counts in alphabetical order.) You have to decide which methods to implement. For example, suppose the text is this: The elephant ate the banana and the giraffe ate the banana. The output would produces this list: and 1 ate 2 banana 2 elephant 1 giraffe 1 the 4 Hint: Think Bank Accounts! (Use what you learned in the Bank Accounts program.) Required Submission: 1. The Java source code file (e.g., HW8.java) 2. The data input file containing the sentence to be parsed (e.g., input.txt) 3. The program generated output file (e.g., output.txt)

RGFJ5L The Asker · Computer Science
intro java No global variable ,
Get data from input , print to ouputFile
extra credit one also pls

Transcribed Image Text: Homework - Topic 8 - Word Count: Write a program that reads in and prints a text, line by line, and calls a series of methods as needed. The object of the program is to parse a sentence in order to figure out all the different words that are in the sentence and how many times each word occurs. Use two parallel arrays, one to store the different words (e.g., String[] word) and one to store the appearance count for each word (e.g., int[] wordCount). At the end, print the list of different words and their counts. (Extra Credit: print the list of words and their counts in alphabetical order.) You have to decide which methods to implement. For example, suppose the text is this: The elephant ate the banana and the giraffe ate the banana. The output would produces this list: and 1 ate 2 banana 2 elephant 1 giraffe 1 the 4 Hint: Think Bank Accounts! (Use what you learned in the Bank Accounts program.) Required Submission: 1. The Java source code file (e.g., HW8.java) 2. The data input file containing the sentence to be parsed (e.g., input.txt) 3. The program generated output file (e.g., output.txt)
More
Transcribed Image Text: Homework - Topic 8 - Word Count: Write a program that reads in and prints a text, line by line, and calls a series of methods as needed. The object of the program is to parse a sentence in order to figure out all the different words that are in the sentence and how many times each word occurs. Use two parallel arrays, one to store the different words (e.g., String[] word) and one to store the appearance count for each word (e.g., int[] wordCount). At the end, print the list of different words and their counts. (Extra Credit: print the list of words and their counts in alphabetical order.) You have to decide which methods to implement. For example, suppose the text is this: The elephant ate the banana and the giraffe ate the banana. The output would produces this list: and 1 ate 2 banana 2 elephant 1 giraffe 1 the 4 Hint: Think Bank Accounts! (Use what you learned in the Bank Accounts program.) Required Submission: 1. The Java source code file (e.g., HW8.java) 2. The data input file containing the sentence to be parsed (e.g., input.txt) 3. The program generated output file (e.g., output.txt)
See Answer
Add Answer +20 Points
Community Answer
R8R5NY The First Answerer
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

This is a very big question. I have solved all of them. Please give me an upvote dear, Much Appreciated.!!   i have uploaded all required submission file use below link to download it. https://mega.nz/file/TMM3nCgK#w8pWpq1bkoP_QaW8UCWqunwKkibkN2LPcSzDuWUpHeU     Code: import java.util.Arrays; import java.util.Scanner; public class Main { public static void prinWordFrequency (String text) { text = text.toLowerCase (); String arr[] = text.split (" "); Arrays.sort (arr); String[] words = new String[arr.length]; int[] counts = new int[arr.length]; words[0] = arr[0]; counts[0] = 1; for (int i = 1, j = 0; i < arr.length; i++) { tif (arr[i].equalsIgnoreCase (words[j])) t { t counts[j]++; t } telse t { t j++; t words[j] = arr[i]; t counts[j] = 1; t } } for (int i = 0; i < words.length && words[i] != null; i++) { tSystem.out.println (words[i] + " " + counts[i]); } } public static void main (String[]args) { Scanner sc = new S ... See the full answer