• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Reading and Writing Objects

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there! Ok, here is the background for what I am trying to do.

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) 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.
3) Then once all of the data is entered the data will be written to the Salesman.data as objects instead of text.
4) 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 then last prints the information to the output area on the GUI in alphabetical order (as it did before).

The above mentioned steps I have been working on and so far the code below is where I am at and I am little bit stuck. There are two other things I must do to this code, but I figured I should worry about the other stuff first. The other two things are:

1) 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%.
2) 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.
* But, I figured I would get the first few steps going first then worry about those two.

So, if anyone has any comments or ideas for me, please just let me know. I need all the help I can get with this one. Also, I am sorry if my description/explanation of the application I am trying to code is too detailed, I wasn't sure if I should go into a ton of detial or not. So I just thought I would give a good description 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!!

Thanks again!!! Any little tips to help me get going again would be awesome!
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you use XML data representation?

Using XML is not trying to use all *Hi-Tech* methodologies in you program, but trying to be flexible and manipulate the info in a efficient manner

When you parse the XML, you automatically get the DOM tree representation. From there on its very easy to do any kind of query/manipulation like variable Bonus, and other operation you might want to introduce later´┐Ż

Any day, I would vouch for XML data representation rather than flat files using string delimiters. (Not because the data storage looks neat and orderly, but because the kind of operations I can do with XML data representation. Also Java+XML work really well together.!!)

pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic