Holly Leery

Ranch Hand
+ Follow
since Sep 08, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Holly Leery

Hello everyone! I�ve got a question for you. I am writing a SalesmanClient and a SalesmanServer, everything is working great so far, but I am a little stuck now. I have a GUI that pops up when I run the SalesmanClient that lets a user enter sales data, change sales data, read a text file, write a text file, write objects to a file and read those objects and prints them to the output text area. Now that all of that is working, I want to change the writing objects part. I have a writeObjectFile() method that writes the objects to a file, but what I would rather do is send that vector to the server and let the server write the objects to a file and then print that information to the Command Prompt as well. Is this something anyone could give me a few hints on? If this doesn�t make sense, just let me know and I will either post some more code for you or try to explain a little bit better. I appreciate your insight and your time!!!

Here is the SalesmanServer:


WriteObjectFile():


SalesmanClient main:


Thanks again everyone, I appreciate it!!
19 years ago
I realize my post above was probably not the best, I didn't really know how to post and ask those couple of questions without posting all of that long code. I apologize for that. I have been trying to get that for loop in the existing user panel to work for a couple of days now and I am sure it is ridiculously easy, I just dont see it. I decided to repost just that little part of the code. I am trying to test if guest and terminator are entered by the user (which are the default passwords) and then also if any exitsing user has entered a name a password...for this I check the User array list I created. I know I need to run through the array and that is why I used for (Users user : myList), but it doesn't seem to want to work properly, is there a better way to set up this for loop? Thank you for any help you may be able to give, if you don't have time, I understand.



Also, I really do not know what to post for the populating data fields part, I just want to popualte a text field and two combo boxes when a user enters a name into a Salesman Text Field, is there a way of doing this? Maybe there is some reference I could look at. I hope this post is a little better than the long one above. Again, thank you for any help you may be able to point in my direction and for your time. I very much appreciate it.
19 years ago
Hello everyone!! I am having two problems with a JMenu program I am working on. First, the Existing User Panel - I know that I need a for loop to determine if the password entered for an existing user is in the ArrayList Users, however when determining if the password entered is "terminator" (which is the guest password) I do not need it, so I am having trouble determining the best way to set this up. Does anyone have any ideas for me?



The second thing I am struggling with is populating the data fields in the Current Salesman Panel. I am just not quite sure how to go about this. What I would like to happen is when a user enters the name of a Salesman then their previous entry of information pops up in all of the fields and then the next time their name is entered the newest data after that pops up into the fields. Anyone have any ideas for this part?



I will post the entire code if anyone needs/wants me to. I wasn't sure if it would be easier to just show the parts that I am unsure of or the whole thing, so if you would like me to post the whole thing I would be happy to. I would greatly appreciate any tips or help anyone could give me. Thank you so much in advance.

Oh also, on a text area called output is their a way to put a JScrollPane? Here is an example of a text area I am using:



Thanks again!!!
19 years ago
Do you mean something like this:



I still can't get it to run right. It just pops up on every name.
19 years ago
Hello everyone! I am having some trouble creating a NoSalesException. I am not getting any errors or anything like that, it just is not running properly. When I first run the program it pops up 5 times and then never pops up again. I think the exception should be thrown from calculateSales and handled from the calling method; however I could not get that to work. When I handle this exception, it will print a warning message dialog box that states the name of the salesman and that he has no sales. So here is my Sales code and NoSalesException.

NoSalesException:


Sales:
19 years ago
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?


Sales:


Classification:


NoSalesException:


[ March 23, 2006: Message edited by: Holly Leery ]
[ March 23, 2006: Message edited by: Holly Leery ]
19 years ago
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.

19 years ago
Ok, that makes sense, thank you. Is there a way to format the data to look a certain way and set it in the textarea? What I am doing does not seem to be working properly.
19 years ago
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:

19 years ago
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):

Jones&2&5&3&0&8&SENIOR
Smith&6&0&2&0&5&JUNIOR
Douglas&1&0&7&5&3&ENTRY
Hollins&9&6&3&7&15&ENTRY
Smythe&0&0&0&0&0&SENIOR
Billings&0&7&12&15&2&JUNIOR
Kozak&3&5&8&22&0&ENTRY

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!!

Sales:


Salesman:


Classification:


Thanks again!!!
19 years ago
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.
19 years ago
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?



19 years ago
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.

TOTAL SALES

NameXXXXXX
NameXXXXXX

TotalXXXXXX

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!!



Class Salesman:
19 years ago
Hello everybody!! I was hoping to get a few pointers on the following code. I have class Sales and class Salesman. Class Salesman has attributes name and sales. I am mainly stuck because I am not sure how I should set up the switch statement in class Salesman.

I want to calculate the total sales for each salesman and the grand total of those sales. I realize the GUI is not the best, but I guess it is ok. LOL. So the user will input their name, the product they sold, and how many of that product was sold. I also put a button for the user to click when they are done entering their information and a button to indicate that all salesmen have entered their information and may be totaled.

Then it should display the total retail value of all products sold for each salesman and then the total of all sales. The final information will be printed to the text area where the salesmen names are in alphabetical order (which I haven't even began to figure out yet) and then their sales to the right of their name (one or two tabs over). Under that I will have the grand total: Total$0.00





Thanks so much for any tips or suggestions!! Much appreciated!!
[ February 18, 2006: Message edited by: Holly Leery ]
19 years ago
Alright, I finally got what you all were saying..lol!! It just clicked. I was sitting here looking at it and all of the sudden it just clicked in my head!! I got the applet running, thanks to all of the help and advice!! It was so small, but I just wasn't seeing it at all!! Thank you all so much for all of the great tips, I learned a lot from this already. Thanks again I appreciate everything!
19 years ago