i was given an assignment to read from a file and find out the statistics of all the letters in that file. considering it is part of an arrays lesson, i am assuming we need to use those.
if someone could help me out, it would be greatly appreciated. thanks,

here is the actual assignment:

Scan the Old Testamaent (King James version) available at http://www.loveallpeople.org/kjvpage.html (Use the txt version) and determine the statistics of each letter (A-Z) and output your results:
A - 3.23%
B - 5.01%
Z - 0.91%

Ok, so now you just need to post the code you have so far and specific questions about it.

thats the thing... i dont know where to start

thats the thing... i dont know where to start

Start by deciding what you need to do to complete the assignment. From that list, decide what you already know how to do and what you do not. Decide the overall organization of the program. For example, what should the classes be? What should each class' data members be? Methods? What should be in main? What shouldn't? Should the methods be static? Etc. The answers may depend on how experienced with Java you are.

You need to be able to open and read from a file. Do you know how to do that? If not, tackle that. You also need to be able to set up counter array(s). Do you know how to do that? And you need to be able to parse the text and increment the counter array(s).

Regarding where to start, it's hard to say because we don't know your experience level. I would say, start with a single class, set up a basic default constructor, and call that constructor from main. Compile it and run it. Have it display "Hello World" in the constructor to make sure the constructor is being called (delete that later). Then set up the counter arrays, compile it and run it again, then post back here with the progress.

And definitely answer the question(s) Vernon posed. . what IS your experience level? What concepts do you know that he mentioned?

Ok, just for some things to think on:
- You need a "bin" to keep track of how many times you encountered each character. An array would work really well for that.
- Each letter, as a char, has an offset from 'a' that can be easily calculated.
- You need a zero-based index to access/increment the correct "bin" (element) for each letter's count.

Have an array of 26 integeres , count occurance of a-z there. Hope this will get you started for your project assignment.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.