Making lists is a routine activity in our daily lives. During the week we may make a list of things to be purchased over the weekend. Or it may be a list of people we wish to invite for dinner. In its simplest form a list consists of a series of items ordered sequentially. A simple list of names could look like:

1. Michael Jackson

2. Tracy Chapman

3. Taylor Swift

4. Paul McCartney

5. Kishore Jumar

A phone list could look like (phone numbers have been masked):

1. Sachin G 98101XXX76

2. Ajay M 98210YYY45

3. Priya A 98110ZZZ32

4. Barry L 617XYZ2315

5. Deepak V 510ABC3216

And a more complex list - for example, a shopping list could look like:

1. Tomato Ketchup - 2 bottles of 1Kg

2. Milk - 2 packs of 1 Litre

3. Yellow Butter - 1 pack of 500 gms

4. English Breakfast Tea - 1 box of 100 teabags

5. Strawberry Jam - 1 bottle of 500 gms

Note in each case there is a sequential ordering and each item in any of the 3 lists above has a similar structure. The structure of the third list will require some thought to arrive at a generic structure for a “grocery shopping item”.

## Challenge – Part 1

In this challenge you will use collections to implement a Text Analyzer. In the current age of word processors, it is so simple to look at the bottom of the screen and immediately come to know how many words we have typed in our document. Or how many characters we have used. How exactly is this done ? You will find out some of the basic building blocks for yourself as you tackle this challenge.

**Task 1** – Design a class called **Word** that can be used to store details of a word that is read from a text file. Apart from the word itself, the class should have an attribute to store the number of times the same word occurs in the file. Define appropriate constructors and getter & setter methods for this class.

**Task 2** – This task involves reading a text file and creating a word list. Your word list will consist of objects of the type **Word** defined in Task 1. You should take care to ensure that no word is repeated in the list. Instead, if a word that already exists in the list is found, simply increment the word count. Once, you have read all the words in the file, use a method called **showWordList()** to show all the words that have been found along with their frequency.

**Task 3** – Notice in the output displayed in Task 2, that the words are not shown in any specific order. They are simply displayed in the order in which they were found in the file. Now refactor your program so that the word list is constructed in such a way that the words are placed in alphabetical order starting with the word “a” (if it exists in the file). Display this sorted word list.

**Task 4** – Write a method that shows the words in your word list in reverse alphabetical order. In other words, you will need to begin with the last word in your list and display its details first. And then come backwards and show all the words in the reverse order.

**Task 5** – Write an additional method called **showFrequentWords()** that reads your alphabetically sorted word list and displays the words in descending order of frequency i.e. the word with the highest frequency is listed first, then the word with the next highest frequency, etc. If 2 words have the same frequency, they should be listed in alphabetical order.

**Note:** You can use the Java Collections API for this challenge.

Skills: Java

About the Client:
( 1 review ) Regina, Canada

Project ID: #34016848

Awarded to:


An IT Based Company with experience of 5 years at your service WHY YOU SHOULD HIRE US ? 1)We are expert in Java, C++, C#, Python, Digital Marketing, Data Entry, Data Processing, Sql Data Processing, Web Scrapping,Repor More

$80 CAD in 1 day
(142 Reviews)

7 freelancers are bidding on average $95 for this job


Hi sir I am interested to work with you. I can provide you professional web design services. I can design for you according to your requirements. I will give you unlimited revision until you will not satisfy for your d More

$30 CAD in 1 day
(95 Reviews)

Hello Sir/ Ma’am A skilled full stack developer, I have rich experience in JAVA,C, C++, C#, Python, .NET , MYSQL, SQL, IONIC , MATLAB,PHP and ARDUINO. I am very confident with my skills and I'd like to help your bu More

$40 CAD in 7 days
(38 Reviews)

Hello I have gone through the job description and understand that you need TextAnalyzer I am an Expert IN JAVA with over 6 years experience in working on it Can we discuss the project and scenarios in more detail so More

$140 CAD in 7 days
(5 Reviews)

Hi there, I have years of experience developing projects with Java and implementing algorithms. Mastering its bases perfectly, object-oriented, functional programming, thread programming, data structure, JDBC connectio More

$80 CAD in 7 days
(20 Reviews)

TextAnalyzer Hi, • This is Sairus Khalil from DW Solution online. • I'm certified in short animated video by • You can also check certifcate in my profile. • DW Solution Online is providing Video Edi More

$155 CAD in 7 days
(0 Reviews)

Hi Dear, Greetings from Alexsandar Going through your project description, I have been interested in it. Could you give me an opportunity to do this job? I would like to discuss more details in chat or interview so we More

$140 CAD in 7 days
(0 Reviews)