-
reading,sorting,displaying data from a text file
How do i accomplish the task below using java. Please include code.
Consider a text file which contains a minimum of 20 english sentences one per line. You are required to write a program which will list the first three words which have the highest frequency of use and the three words with the lowest frequency of use. eg. if the words in a text file had the following frequency of use as shown below
Time table - 4
security - 2
projector - 3
monday - 10
morning - 7
classroom - 5
cleaner - 6
director - 1
lecturer - 2
evening - 8
the program should produce an output such as:
Words with highest frequency of use:
monday 10
evening 8
morning 7
Words with the lowest frequency of use:
director 1
lecturer 2
security 2
note: the words with the same frequency of use are listed in alphabetical order. Assume that all the words in the text file are in lower case and are seperated by one or more spaces.
bahcoach
-
Maybe if you offer money someone will do it all for you, but you won't learn anything. As I said in the other post, tell us specifically what it is you're having trouble with and someone will help.
-
Check out the static method Collections.sort() and
the Comparable interface.\, and java.io.BufferedReader
eschew obfuscation
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks