Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help filling in the code with JAVA, I've highlighted what needs completing. import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.Set; import java.util.TreeSet; /** *

Need help filling in the code with JAVA, I've highlighted what needs completing.

import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.Set; import java.util.TreeSet; /** * UniqueWords - Write a program that uses a TreeSet to print each * unique word from a file alphabetically * Based upon P16.1 in Big Java */
public class UniqueWords { public static void main(String[] args) throws FileNotFoundException { Set  words = readWords("wordlist.txt"); for(String word : words) System.out.println(word); } /** Reads all words from a file and puts them into a set (a tree set) @param filename the name of the file @return a set with all lowercased words in the file. Here, a word is a sequence of upper- and lowercase letters. */  //-----------Start below here. To do: approximate lines of code = 6 // 1. static method readWords returning a set of Strings ... FileNotFoundException {//opening of the method //2. let 'words' be a set of Strings, constructed as a TreeSet //3. let 'scanner' be based on a file with name 'filename' //4. let scanner useDelimiter any run of one or more (+) characters //other than a-z or A-Z //5. while scanner has another word //6. Put the lower case version of that word into 'words'. return words; //returning the set of words from file 'filename' }//closing of the method //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mysql Examples Explanations Explain Examples

Authors: Harry Baker ,Ray Yao

1st Edition

B0CQK9RN2J, 979-8872176237

More Books

Students also viewed these Databases questions

Question

How much will they receive from the liquidation?

Answered: 1 week ago

Question

3. Define the roles individuals play in a group

Answered: 1 week ago