Thread View: aus.computers.java
4 messages
4 total messages
Started by Funtybugwana
Tue, 16 May 2000 00:00
Array problem- struggling 1st Year student
Author: Funtybugwana
Date: Tue, 16 May 2000 00:00
Date: Tue, 16 May 2000 00:00
12 lines
1105 bytes
1105 bytes
Can one of you good people please give me a pointer on how to initialise an array with information which I have pulled from a text file.. The assignment which I have been given is to use arrays to pull all words from any document, count occurences of the word and sort it in order..Not a hard task.. well Im dying.. I have used streamTokeniser to pull in the document using a GUI interface which is great but thats about it, I cannot work out how to get that info into the array with the text book and lecture notes given... Please help me Mark
Re: Array problem- struggling 1st Year student
Author: Alan Boldock
Date: Thu, 18 May 2000 00:00
Date: Thu, 18 May 2000 00:00
37 lines
2129 bytes
2129 bytes
Perhaps you should read your streamTokzenizer and retrieve each word and either stuff them in a Vector or read the file twice and do it the first time just to get the word count. Use this word count to initialise your array (to that size) then read the file again putting each word into the Array. A better one pass approach would be to read each word into a Vector (You don't need to initialise a Vector with a size) then at the end get the vector size, make the array then use the Vector.copyInto(Object[]) method to read your Vector into your array. There are more sophisticated approaches but for a beginner this is an easy conceptual approach. Alan "Funtybugwana" <funtybugwana@icqmail.com> wrote in message news:L1lU4.43$GC4.489545@news0.optus.net.au... > Can one of you good people please give me a pointer on how to initialise an > array with information which I have pulled from a text file.. > > The assignment which I have been given is to use arrays to pull all words > from any document, count occurences of the word and sort it in order..Not a > hard task.. well Im dying.. > > I have used streamTokeniser to pull in the document using a GUI interface > which is great but thats about it, I cannot work out how to get that info > into the array with the text book and lecture notes given... Please help me > > Mark > >
Re: Array problem- struggling 1st Year student
Author: someguy
Date: Thu, 18 May 2000 00:00
Date: Thu, 18 May 2000 00:00
50 lines
2584 bytes
2584 bytes
hey i know the assignment your doing... by any chance is it for a subject perhaps that might be called 410? hahaha..member you are supposed to implement it in a command line interface instead of a gui as the primary interface. "Alan Boldock" <aboldock@camtech.net.au> wrote in message news:lGHU4.35613$PL4.717065@ozemail.com.au... > Perhaps you should read your streamTokzenizer and retrieve each word > and either stuff them in a Vector or read the file twice and do it the first > time just to get the word count. Use this word count to initialise your > array (to that size) then read the file again putting each word into the > Array. > > A better one pass approach would be to read each word into a Vector > (You don't need to initialise a Vector with a size) then at the end get > the vector size, make the array then use the Vector.copyInto(Object[]) > method to read your Vector into your array. > > There are more sophisticated approaches but for a beginner this is an easy > conceptual approach. > > Alan > > > > "Funtybugwana" <funtybugwana@icqmail.com> wrote in message > news:L1lU4.43$GC4.489545@news0.optus.net.au... > > Can one of you good people please give me a pointer on how to initialise > an > > array with information which I have pulled from a text file.. > > > > The assignment which I have been given is to use arrays to pull all words > > from any document, count occurences of the word and sort it in order..Not > a > > hard task.. well Im dying.. > > > > I have used streamTokeniser to pull in the document using a GUI interface > > which is great but thats about it, I cannot work out how to get that info > > into the array with the text book and lecture notes given... Please help > me > > > > Mark > > > > > >
Re: Array problem- struggling 1st Year student
Author: Funtybugwana
Date: Mon, 22 May 2000 00:00
Date: Mon, 22 May 2000 00:00
24 lines
1577 bytes
1577 bytes
Just like to thank the people that have so graciously helped me with my problem, I have submitted it although its not working just how I would have liked, a lot of hard work with little reward, I guess that is programming though and it is all a learning curve.. Thanks again "Funtybugwana" <funtybugwana@icqmail.com> wrote in message news:L1lU4.43$GC4.489545@news0.optus.net.au... > Can one of you good people please give me a pointer on how to initialise an > array with information which I have pulled from a text file.. > > The assignment which I have been given is to use arrays to pull all words > from any document, count occurences of the word and sort it in order..Not a > hard task.. well Im dying.. > > I have used streamTokeniser to pull in the document using a GUI interface > which is great but thats about it, I cannot work out how to get that info > into the array with the text book and lecture notes given... Please help me > > Mark > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads