I am working on a program and am 95% done, but am stuck. My program creates a file and the user can file it with account ID's and balances. The issue I am having is that when a user enters a duplicate account ID it needs to throw an error and I am thinking after the error it should then ask for more ID's. At this point I can enter all the ID's I want and after I enter a duplicate entry it does throw the error, but then the program exits. How do I get it to continue asking for ID's.....any hints?
Break long lines and change // comments to /* */ to reduce horizontal scrolling CR[/edit]
It's pretty simple, move the DuplicateAccountException catch block inside the while loop.
What I would be more concerned about is that you're keeping the file open all the time, and doing your checking directly from the file.
It's probably a better idea to read all the IDs into a set first, and then checking the set whether it already contains the ID. This will be much more efficient than seeking the disk.
Also, consider splitting up your program into separate methods. This will make it easier to read and maintain the program.