Hello there! I posted this code a few days ago, but I really shouldn�t have at the time because it was not near complete. But, I have made a lot changes and added a few things to the application. So now basically I am just wondering if someone could just let me know if I am on the right track with the switch statement and the action listeners.
The application I am building will calculate the total sales for any number of salesmen. The application will allow the salesman to enter their name, the product (numbered 1-5) they sold as well as the amount of products they sold. They would then hit done to tell the application that the salesman is done entering his information. Once all of the salesmen have entered their information they can hit Grand Total and the grand total of those sales will display in the text area.
I put together a GUI in flow layout, but the text fields are not allowing me to type in the field, is there a particular reason that might happen? Maybe I just missed something.
Also, the final information will be printed in alphabetical order, which I haven't done yet, but I think I will use sort to do that. This will all be sent to a .txt file as well by the way.
So anyway that is a brief run down of what I am trying to do. Any little tip just letting me know I am on the right track or whatever would be appreciated!! Thanks so much everyone!!
Ok I have even bigger changes than before. I am sorry I keep posting this, I am just hoping to get a little feedback on how I am doing. Everything seems to be working great (it compiles) except for when it should be reading and writing the data to the textarea and to the .txt file. I'm wondering if the problem might have to do with myList. Could this be the case?
You should open a file stream only if you need to and close it right after you don't need it anymore. From Sun's tutorial: "A program should close a stream as soon as it is done with it, in order to free up system resources." Also your members are static which isn't necessary.
Are you saying I might need to move the file writer and buffer to open just before I run the calculations and close after I print the information to the output? Everything seems to be running properly but the output is not being sent to the text area and the calculations are not taking place. The text is being sent to the .txt file. The calculations just are not happening.