StringTokenizer, substring, for loop, while loop, filereader, filewriter
brando brandido
Greenhorn
Joined: Jan 11, 2012
Posts: 20
posted
0
hello,
i have some text in notepad that looks like this
i am ask to create a program to call the notepad and make the output looks like this
Product 1 Product 2 Product 3
Day 1 5000 5859.99 6001.75
Day 2 5555 7750.99 6000.50
Day 3 5877 5559.30 6578.98
i posted this in a different thread but seems the suggestion are too advance for me? i just want it simple and easy to explain.
i am a bit confuse, so i hope you guys can advice me
so so far what i've done is this;
the problem with the above code is that, the amount "5000" won't appear,
the output will look like this;
Product 1 Product 2 Product 3
Day 1 5859.99 6001.75
Question: what should i do in order that the amount "5000" will be included in the second FOR loop?
so in my own way, for me to get the "5000" amount i modified the code to like this, and that's the time i got all the amount on day 1.
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
9
posted
0
There's so much wrong with that code that the best advice anyone can give you is to dump it and start again.
Campbell's usual advice is to write down the steps that you will need to do on a piece of paper. Then refine each step into smaller steps. Keep doing this until all the steps consist of a few one or two syllable words. Don't write any code until you've done this.
Then switch to Fred's usual advice. For each step you have defined, write a few lines, compile them and test them and only when they do exactly what you want should you move on to the next step.
If you do things like this, then when you do come across a problem, you can narrow it down to exactly where in the code it is and then you will only need to post that bit of code on these forums. The less code you need to post to explain the problem, the easier it is for other people to scan the code and spot what the problem is.
Joanne
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
4
posted
0
I think you ought to continue on the original thread. I shall close this one, and copy your post onto the old thread.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
4
posted
0
Have you been taking lessons from Rob, Joanne?
There I was, closing threads so I could write about pencils elsewhere and you manage to slip in a post before me!
If you click the link in that previous line, you get to the location where I copied that post.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: StringTokenizer, substring, for loop, while loop, filereader, filewriter