d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need Help With Java Project, Paying 2000fg > Need This Done Asap.
Add Reply New Topic New Poll
Member
Posts: 25
Joined: Feb 8 2013
Gold: 4,000.00
Dec 12 2013 03:15am
Project involves reading through an entire book and counts the number of times that word shows up.
This project is set around Collections (LinkedList, HashMaps, LinkedHashMaps, etc...)

If you're interested lmk.
Member
Posts: 1,081
Joined: Aug 25 2013
Gold: Locked
Trader: Scammer
Dec 12 2013 01:06pm
like you import the book from a .txt file?
Member
Posts: 9,145
Joined: May 11 2009
Gold: 5.01
Dec 12 2013 08:28pm
What is the timeline on this? Send requirements to me in pm.
Member
Posts: 862
Joined: Apr 7 2011
Gold: 1,595.00
Dec 26 2013 03:28pm
PM me if still looking for help
Member
Posts: 1,143
Joined: Apr 24 2006
Gold: 0.00
Dec 30 2013 08:45am
can do it, pm me if you still need help
Member
Posts: 2,757
Joined: Nov 26 2007
Gold: 1,214.81
Dec 30 2013 09:23am
Code
Map<String, Integer> wordMap = new HashMap<String, Integer>( );
try {
FileReader file = new FileReader( new File( "book.txt" ) );
BufferedReader br = new BufferedReader( file );
String temp = br.readLine( );
while ( temp != null ) {

String[] words = temp.split( " " );
for ( String word : words ) {
int count = 1;
if ( word.trim( ).length( ) == 0 ) {
continue;
}

if ( wordMap.get( word ) != null ) {
count = wordMap.get( word );
count++;
}
wordMap.put( word, count );

}
temp = br.readLine( );
}
}
catch ( Exception e ) {
}

System.out.println( wordMap.get( "the" ) );


This post was edited by labatymo on Dec 30 2013 09:25am
Member
Posts: 2,095
Joined: Apr 15 2003
Gold: 100.08
Jan 10 2014 01:39pm
pm tech. stack, details & timeline
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll