Re: Please Help, Urgent!!!!!!!

From: Scott Ellsworth (scott_at_alodar.com)
Date: 03/29/04


Date: Mon, 29 Mar 2004 10:05:59 -0800

In article <cfca99bf.0403281933.223eca3@posting.google.com>,
 mlavia@yahoo.com (Michael Lavia) wrote:

Given that you were obvious about the source of the problem, and did put
something together, I will throw one hint your way. For more hints, try
to identify one large scale problem, such as a compiler error message
you do not understand. Read the FAQ and a good java book, and if you do
not get it, post.

> Here is my code so far, and it is wrong....but i need to get this
> done, please help:

Again - be very specific about what is wrong with it, and your guess as
to why.
>
> class StringRead {
>
> public static void main(String[] args) {
>
> int decWords = 0;
> int[] decWords = new int[12];
> BufferedReader = dcl;

I bet you are getting a "dcl not defined here" error, or some other
syntax error. Try:

                   BufferedReader dcl;
                   BufferedWriter writer;
                   StringTokenizer st;

> BufferedWriter = writer;
> StringTokenizer = st;
> String line;
>
> dcl = new BufferedReader(new FileReader(new File
> "Declaration.txt"));

Are you getting some message about an uncaught exception? Look up
try/catch.

> writer = new BufferedWriter(new FileWriter(new
> File(decWords[12])));
Describe really simply what this line is intended to do, and what it
works on, and you should be able to see the problem. Hint: a File
demands a string containing the name of the file to open, and you have
sent it an integer.

> st = new StringTokenizer(dcl);
> while ((line = reader.readLine()) != null) {

Shouldn't you be using the string tokenizer here? Perhaps you want to
grab the next token and see how long it is.

> writer.write(line);

I doubt you want to just copy the file, which is what this appears to
do. It seems more likely that you want to examine a word, see what
length it is, increment the appropriate entry in the array, and then
print out that array when it is all over.

> writer.newLine();
> }
> reader.close();
> writer.close();
> }
> }
> }

Good luck - check the FAQ and a good book, and have at it.

Scott

--
scott@alodar.com
Java and database consulting for the biotech community


Relevant Pages

  • Re: Parsing Data, Storing into an array, Infinite Backslashes
    ... > I am using this function to parse data I have stored in an array. ... It looks like you are setting the variable qval to the string ... Hint: it ...
    (comp.lang.python)
  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
    (microsoft.public.fox.helpwanted)
  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
    (microsoft.public.vc.mfc)
  • RE: Structure conversion from C++ to VB-2008?
    ... One of the most important structures is AmiVar structure. ... point number, the array of floating point numbers, a string or IDispatch ... Dim 13012679 as Integer ...
    (microsoft.public.dotnet.languages.vb)