Question: Edit this cross - reference code so that it is separated into different methods and prompts for a . txt file on a cs server
Edit this crossreference code so that it is separated into different methods and prompts for a txt file on a cs server instead of your computer. Include an additional prompt asking for if noise words are to be included in the output.
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 file name: ;
String fileName innextLine word;
int lineNumber;
ScannerWithLineno swl null;
TreeMap map new TreeMap;
try
swl new ScannerWithLinenonew Filealicetxt;
while swlhasNext
word swlnext;
lineNumber swlgetLineno;
ifmap.containsKeyword
map.putword new LinkedHashSet;
map.getwordaddStringvalueOflineNumber;
Set keys map.keySet;
forString key: keys
System.out.printlnkey : map.getkey;
swlclose;
catch FileNotFoundException e
eprintStackTrace;
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
