This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am trying to allow my program to accept multiple transaction records. I have created a file creator (CreateData) to populate two text files (oldmast.txt, trans.txt). CreateData will need to be run to create these two files. I have also created a file matching class (FileMatch) to process and write the processed information to newmast.txt and log the unnecessary transactions to log.txt. FileMatchTest will need to be ran to process the files. The problem that I am having is that my program will not allow multiple transactions. Specifically transactions, transactions, and transactions. In theory, my newmast.txt file should have all the accounts listed with the correct balances. Can anyone give me any pointers for how to accomplish this? Thank you.
[ September 09, 2008: Message edited by: Patrick Boos ]
Basically, I am running into a problem combining the transactions as they are read through the FileMatch class. I have a combine method in AccountRecord that is called in the processFiles method in FileMatch. It combines the first two transactions with the account records, but it does not combine the final three. To isolate the problem, I believe the problem lies in my processFiles() method in the FileMatch class. I would just appreciate some guidance for how to accomplish combining all of the records into the newmast.txt file. Any help is appreciated. Also, I don�t know what happened, but my code posted twice for some classes. Should I repost it? Thank you.
Originally posted by Patrick Boos: Also, I don�t know what happened, but my code posted twice for some classes. Should I repost it? Thank you.
You can edit your post by clicking on [url=]this image[/url](i find that the insert image option is missing from the editor so i have to give you the link to the image) on top of your post. [ September 09, 2008: Message edited by: Nitesh Kant ]
Originally posted by Patrick Boos: my code posted twice for some classes.
You can edit your post by clicking on the icon that looks like a pencil and paper next to the post time: However, removing the duplicate code still leaves hundreds of lines. You need to trim this down to part that's causing you the problem. Can you reproduce your problem in 10 or 20 lines of code?
[ September 09, 2008: Message edited by: Joe Ess ] [ September 09, 2008: Message edited by: Joe Ess ]
Joined: Sep 09, 2008
Thank you Nitesh and Joe. I wish I could reproduce in 10-20 lines of code. I can't seem to pinpoint the problem as some of the accounts get updated and others do not. I think the problem lies in the FileMatch class, so I edited my original post to only show that class. The processFiles() method is where the accounts are compared, but there are other methods within the class that may be helpful to look at as well. Thanks.
That's still too much code for me. Maybe someone with more free time will happen along. In the mean time, my advice is to throw in a bunch of logging statements at crucial intervals (I usually log method calls and the results of important logical branches). Then you can observe what your program is doing and figure out how that differs from your expectations.