Hello there! I was hoping I could get a few pointers on the code below!! Ok, here is the background for what I am doing.
1) The program will read the original sales data from SalesData.txt, that will create salesmen and then that information will be entered into the array list Salesman. The file looks like this (just so ya know):
2) Each salesman has a level type of ENTRY, JUNIOR, or SENIOR. There will be an enumerated class for the sales type. There is a variable, bonus, associated with each type. The bonus for SENIOR is 15%. The bonus for JUNIOR is 10%, and the bonus for ENTRY is 5%. 3) The user will be able to enter additional data on the GUI, either a new salesman and his product sales or the user can update an existing salesman. 4) Then once all of the data is entered the data will be written to the Salesman.data as objects. 5) Then also added to the GUI will be an additional button that when it is clicked the user will actually read the Salesman.data file, put the information in a vector, sort it, and last prints the information to the output area on the GUI in alphabetical order. 6) I need to create a NoSalesException. This exception will be thrown from calculateSales and handled from the calling method. To handle this exception, I will print a warning message dialog box that states the name of the salesman and that he has no sales.
I have worked on everything with the exception of the NoSalesException.
So, the program compiles fine, but then I believe the reason why it doesn't work properly after entering in all of the additional salesman information is in the readObjectData method. I was wondering if anyone has any tips or ideas for me in that regard, please just let me know if so. I will take any hlep I can get to finish this one up. Also, I am sorry if this is too detailed, I just thought I would give a good description of what I am doing to begin with that way you had a good understanding of what I am trying to do. Again, if anyone has any tips, ideas or help...please please let me know! Much appreciated!!
Holly Leery: So, the program compiles fine, but then I believe the reason why it doesn't work properly after entering in all of the additional salesman information is in the readObjectData method.
What exactly is it doing after the readObjectData() method call.
Holly Leery: Again, if anyone has any tips, ideas or help...please please let me know!
A couple of things I see that probably have no relation to the problems you're experiencing. In this section of code:
You never call b.getBonus();. Therefore the Salesman never recieves his proper bonus . Also the calls to close() the streams should be wrapped in a 'finally' block so that the occur even if an IOException occurs.
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Oh my goodness you are right I didn't do anything with the bonus...obviously I need to go back in a fix that so that that runs properly. Thank you for pointing that out to me! After the program compiles I can enter in any amount of salesman, the amount of a product sold, that prodct and the salesman level, I then click "All Data Entry Done" which writes the data as objects to Salesman.data and then when I click "Grand Total" to read the data back in and post it in the textarea I get the following error:
Ok I have two parts printing to the output textarea, the TOTAL SALES line and the actual Total line. The individual sales are not being sent though. Could this have to do with the vector? Unfortunetly I am supposed to be using a vector and I think that is part of my problem.
Hello there! I was hoping someone could help me out! I would really appreacaite it! I am almost completely done with the program, I am just having two small problems. 1) I cannot figure out how to handle the enum class. I have to use bonus in the readFileData() method, but I am not sure how I am supposed to declare it. I keep getting errors no matter what I try. I know it is probably something extreamly simple, but I am just not seeing it. 2) In addSalesman() I am using an ArithmeticException that is originally thrown from CalcSales() where I created an Exception "NoSalesException". Well it is telling me I cannot have this in the JOptionPane...why is this and what can I do to fix it? Also can I put the salesman name in there?
[ March 23, 2006: Message edited by: Holly Leery ] [ March 23, 2006: Message edited by: Holly Leery ]
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss