Question: Fix this code so it is actually able to read a file from a cs server, right now it just errors. _ _ _ _
Fix this code so it is actually able to read a file from a cs server, right now it just errors.
import java.ioFile;
import java.ioFileNotFoundException;
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
public class WordCrossReference
public static void mainString args
Scanner in new ScannerSystemin;
System.out.printEnter the server file path egserverpathtofiletxt: ;
String filePath innextLine;
System.out.printInclude noise words in output yesno;
boolean includeNoiseWords innextLineequalsIgnoreCaseyes;
processFilefilePath includeNoiseWords;
private static void processFileString filePath, boolean includeNoiseWords
TreeMap map new TreeMap;
ScannerWithLineno swl null;
try
swl new ScannerWithLinenonew FilefilePath;
while swlhasNext
String word swlnext;
int lineNumber swlgetLineno;
if includeNoiseWords && isNoiseWordword
continue;
if map.containsKeyword
map.putword new LinkedHashSet;
map.getwordaddStringvalueOflineNumber;
printCrossReferencemap;
swlclose;
catch FileNotFoundException e
eprintStackTrace;
private static void printCrossReferenceTreeMap map
Set keys map.keySet;
for String key : keys
System.out.printlnkey : map.getkey;
private static boolean isNoiseWordString word
Set noiseWords Set.ofthe "and", aanoftoin "for", onat;
return noiseWords.containswordtoLowerCase;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
