I have wriiten the following BorrowerListManager class to provide management functions for a Borrower and BorrowerList class. However, I cannot get the 'run' method in this class to work, and consequently can't test whether it even works yet.
The problem is that the conditional statements within this class should call the appropriate methods, but I don't seem to be able to get these to work correctly.
My code so far is as follows,
All I'm trying to do is create a list and then be able to add, delete and search the borrowers. However, the manager class is proving a real pain.
If it will help, the code for my BorrowerList class is as follows,
I've really be struggling with this problem for days now, and any help would really be appreciated!!
It really looks like you're trying to 're-create the wheel' with your BorrowerList class.
If, in BorrowListManager, you had Map borrowerList = new HashMap();
borrowList would already have the methods put() - for add get() remove() size() etc()
only thing missing from your class is the i/o part, which doesn't belong in the class anyway.
borrowerList could even be an ArrayList(), but you are likely to have videoID's and/or memberID's, so a HashMap sounds an ideal candidate.
Joined: Nov 06, 2005
Thanks for all the help. Both the Borrower and BorrowerList classes compile fine, it is only the BorrowerListManager class that is not working.
With regard to HashMaps, I haven't yet covered those so I'm not really sure what I would do with those. Basically, what is the best way to use the information in the BorrowerList and Borrower classes, as detailed below, to create a list in a text file so a user can add and delete a borrower, and of course search for them by membership number as and when required.
Current code for the classes is as follows,
1. Borrower class
2. BorrowerList class
Any advice or help really appreciated!!
Joined: Jun 09, 2003
> With regard to HashMaps, I haven't yet covered those so I'm not really sure what I would do with those.
here's a very basic example - quick'n'dirty (little or no error handling)
enter an id/name into the fields (e.g. 123 Fred) click add click show add another couple of id/name's click show
close program open program click show
type one of the id's into the id field click delete click show
Joined: Nov 06, 2005
Thank you so much for all your help. I shall go through all of this today, and let you know how I get on with the program.