Buffered Reader and Countin words

  • Thread starter spudgun via JavaKB.com
  • Start date
S

spudgun via JavaKB.com

I've been given a question to do. Using a buffered reader I need to open a
file and then count the number of words, number of characters in words and
the number of odd and even words. I've got no idea of even where to start so
is there anyone who can help me?

Cheers in advance
 
A

Andrew Thompson

I've been given a question to do. Using a buffered reader I need to open a
file and then count the number of words, number of characters in words and
the number of odd and even words. I've got no idea of even where to start..

<http://www.physci.org/codes/javafaq.jsp#start>

A better group for Java beginners is ..
<http://www.physci.org/codes/javafaq.jsp#cljh>
...referred to in your web interface as 'First Aid'.

While we are on the subject (of web interfaces), please read this..
<http://www.physci.org/codes/javafaq.jsp#usenet>

HTH (Hope That Helps)
 
?

.

I've been given a question to do. Using a buffered reader I need to open a
file and then count the number of words, number of characters in words and
the number of odd and even words. I've got no idea of even where to start so
is there anyone who can help me?

You have to break it down into managable steps. You have been told to use
a BufferedReader. This makes it much easier (less options). So step 1 is
create an instance of a BufferedReader.

Step 2, you need to retrieve the data. What do you need to retrieve the
data? The BufferedReader class will have a limited set of methods to read
in the data. What method looks best? What data type does it use?

Once you have the data read in, check it and make sure this part is
working okay. Once you have it working fine move onto the next step.

Now that you have the data what is ONE of the things you want to do with
it. Write a method that will take the data in and do that ONE thing.

By breaking it down into many simple steps it will be less overwhelming.

Finally, Java (and OOD) is all about grouping data and methods to affect
the data. I like to think of it like cooking. You have your ingredients
(food) and techniques (cut, boil, etc.). The first thing you have to do is
set up all your ingredients (create all your data structures). Then define
the techniques (write the methods to use the data).

Hope that helps,
Darrell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top