Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How i can solve this : building java program,, pleas, solv it.. Write a program

ID: 3636364 • Letter: H

Question

How i can solve this :
building java program,,

pleas, solv it..

Write a program should start by asking the user to enter the name of an input text file. Your program should then read all words in the text file and print to the screen and to a text file all words that occurred in the input file (a word is any set of alphabetic characters that are separated from other words by non-alphabetic characters including numbers, spaces, punctuation and other symbols), with the number of times each word occurred. The name of the file for statistics about words should be “1words.txt”. The program should also ask the user for N, the level of N-grams that should be calculated. It should then print to separate text files all N-grams and the number of occurrence of each N-gram. The name of the file for statistics about an N-gram should start with the level of the N-Gram followed by the word “words”. Thus for bigrams the file should be named 2words, for trigrams the file should be named 3words, etc…
Note that here a bigram is two words occurring near each other; a trigram is a set of three words occurring after each other etc…


thanks...

Explanation / Answer

import java.io.*; import java.util.*; public class SearchWord{ public static void main(String[]args) throws Exception{ Scanner input=new Scanner(System.in); System.out.print("Enter word to find: "); String word=input.next(); if(word.equals("FAIL")){ File f = new File("studentRecord.txt"); BufferedReader freader = new BufferedReader(new FileReader(f)); String s; while ((s = freader.readLine()) != null) { String[] st = s.split(" "); String id = st[0]; String name = st[1]; String marks = st[2]; String result = st[3]; if (result.equals(word)) { File file = new File("result.txt"); FileWriter fstream = new FileWriter(file,true); BufferedWriter out = new BufferedWriter(fstream); out.write(id+" "+name+" "+marks); out.newLine(); out.close(); } } } } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote