Hi, I have a small problem i'm looking for help with.
I have a small program to mimic a simple bank situation.
I have a Customer Class that has a CUSTOMER object with a string FIRSTNAME and BALANCE
and I have a Entry Class that has a string KEY and a CUSTOMER object.
I need to be able to find an entry by key and show the list of entries.
I need to know how to go about this. I have the customer and entry class setup fully and I have started a BANK class with an arraylist.im wondering is the arraylist the right format to use here?
Thanks
Java Program Question
Started by ryansealaner, May 10 2010 08:53 AM
2 replies to this topic
#1
Posted 10 May 2010 - 08:53 AM
|
|
|
#2
Posted 10 May 2010 - 10:15 AM
Hi looking at what you have already, it appears that you have the right idea. A few weeks ago I met with a colleague to discuss the bank problem in software development. We went into a lot more depth than it appears you want to go into. So let me clarify so that I understand.
It looks like you want to write a program that simply displays transactions made on a specific customer's account, is this correct? Given that information I will assume that you will create a static list of transactions somewhere, such as in a file, and that this list will never change. Also there will at this time be no method for interacting with the account other than to look up transactional information based on the transaction number.
Given these assumptions it also appears that your user interface will be customer-centric. That means that I can assume that all of the available information pertains solely to the customer using the interface and that there will not be a teller interface or any other interfaces whereby to manage the account, bank, or customer. If this is wrong, then you might want to think about these components before you begin programming. The point of that is that if you design your program first, then you won't need to re-design it mid-way once you realize that you're missing something. Design is probably the most important step in writing a program. If you haven't thought about your design, then I suggest you back away from your code until you have at least a high-level design of the following:
If my above assumptions are correct, then let's assume that you have stored all transactions in a file, one on each line, and that they are in order by date. I think that using an ArrayList to contain these transactions would be very practical, because they are already ordered. You may think about creating a class to contain transactional data as well. This class probably won't have many or any methods other than a toString() method. But it should contain data such as date, payee, amount, and so on that pertains to the information contained in the transaction file. You may also want to make your constructor parse that information from a string. The toString() method would be used to display the data on-screen when accessing the information.
Start there, and let us know if you would like more help or any kind of direction.
It looks like you want to write a program that simply displays transactions made on a specific customer's account, is this correct? Given that information I will assume that you will create a static list of transactions somewhere, such as in a file, and that this list will never change. Also there will at this time be no method for interacting with the account other than to look up transactional information based on the transaction number.
Given these assumptions it also appears that your user interface will be customer-centric. That means that I can assume that all of the available information pertains solely to the customer using the interface and that there will not be a teller interface or any other interfaces whereby to manage the account, bank, or customer. If this is wrong, then you might want to think about these components before you begin programming. The point of that is that if you design your program first, then you won't need to re-design it mid-way once you realize that you're missing something. Design is probably the most important step in writing a program. If you haven't thought about your design, then I suggest you back away from your code until you have at least a high-level design of the following:
- Objects or classes that represent objects.
- Behaviors of objects.
- Interactions between objects.
- Data that each object should know about.
If my above assumptions are correct, then let's assume that you have stored all transactions in a file, one on each line, and that they are in order by date. I think that using an ArrayList to contain these transactions would be very practical, because they are already ordered. You may think about creating a class to contain transactional data as well. This class probably won't have many or any methods other than a toString() method. But it should contain data such as date, payee, amount, and so on that pertains to the information contained in the transaction file. You may also want to make your constructor parse that information from a string. The toString() method would be used to display the data on-screen when accessing the information.
Start there, and let us know if you would like more help or any kind of direction.
#3
Posted 10 May 2010 - 11:24 AM
Thanks Nathandelane for the very comprehesive answer. I only need my program to add, remove and search entries(which are Entry Class Objects of Customer Objects) using a key in an array. I have drawn up my classes and am just wondering what ArrayLists be Ok for going ahead with this?
Thanks for your time,
Ryan S.
Thanks for your time,
Ryan S.


Sign In
Create Account

Back to top









