the info should actually be like this:
The program's full code is below. Any >< is supposed to be < (I don't know why it does that when I put the code into the forums). The part that's supposed to write the info to a .txt file is lines 130-157. Help would be appreciated, thanks!
Start small. Create a program that just hardcoded entries into a single, 1D array, and then writes that array out. Print out the value of the array to the console so you can confirm that the array's contents are what you expect.
Once that's working, move up to a simple hardcoded 2D array, but keep it small, say 2 rows by 3 columns. Again, print out all the contents to the terminal, and print out any other significant variables, code branches taken, etc., so you can see what your code is actually doing.
Once that works, add the piece that takes user input. And before you do that, you'll be better off if you develop that piece all by itself, as a separate program that takes user input, populates an arary, and prints it out to the screen, without any regard to saving it to files. Once you get that piece working by itself, it will be easier to combine it with the other working piece.
And if you get stuck, create a program that shows ONLY your problem and has no unrelated cruft--an SSCCE(←click) and post it here.
Just trimmed it down. It's half as long now.
fred rosenberger wrote:You might want to consider trimming that down. I doubt many people are going to try and dig through over 400 lines of code to solve your problem. If you could strip out any irrelevant parts, but leave a working program that we can compile and run, you are MUCH more likely to get the assistance you are requesting.
Why are you outputting everything three times in that for loop (130-155)? And why did you hard code those indexes? What if you decide to have 4 of them later, you're just gonna repeat the same code again? You can as well put that code outside that for loop and output the result just once. There are lots of ways to avoid that code repetition you have in what you've posted. E.g. why don't you toString() method in your class and just invoke it each time you want to output it to the console, file or whatever? In combination with for loop and separate method the code would look much better.
Again, you should really consider redisigning your class(es) (some of the tips are given in your previous topic). You seem to be handling this code for some time now, and all you try to do is put almost everything in that main method and just make it work, no matter how.
//tried to loop, didn't work
you surely don't expect us to be able to help you without seeing what you did, do you? You should probably read our FAQ on HowToAskQuestionsOnJavaRanch, and specifically ItDoesntWorkIsUseless.
I will GUESS that you used a single for loop. If you have and array of arrays, you would need two loops.