Question: java help: Seuss.java import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class Seuss { public static void main(String args[]) throws FileNotFoundException { LinkedSet set=new

java help:

java help: Seuss.java import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public

Seuss.java import java.io.File;

import java.io.FileNotFoundException;

import java.io.PrintWriter;

import java.util.Scanner;

public class Seuss {

public static void main(String args[]) throws FileNotFoundException

{

LinkedSet set=new LinkedSet();

File infile = new File("./src./greenEggs.txt");

File outfile = new File("words.txt");

String word=null;

PrintWriter out=null;

Scanner read = null;

try {

read = new Scanner(infile);

out=new PrintWriter(outfile);

while(read.hasNext())

{

word=remmovePunc(read.next());

set.add(word);

}

System.out.print(set);

while(true)

{

word=set.remove();

if(word==null)

{

break;

}

out.write(word+" ");

out.flush();

}

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

public static String remmovePunc(String s)

{

String str="";

String a=s.toLowerCase();

for(int i=0;i

{

if (Character.isLetter(a.charAt(i))){

str=str+a.charAt(i);

}

}

return str;

}

}

Next, revise your implementation of Seuss.java so that instead of using a list-based set, it uses a hash set. Call the new file Seuss3, and use a hash set of size 20 to store the S: 0 ham them here car me 1 the 2 eggs tree 17 18 19 a may if dark you green box be

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!