Results 1 to 4 of 4
Thread: question about arrays
- 02-12-2008, 03:49 AM #1
Member
- Join Date
- Feb 2008
- Posts
- 2
- Rep Power
- 0
question about arrays
I am doing a bank project where we record deposits and withdrawals using positive and negative numbers. Using arrays we store the numbers, positive numbers being deposits and negative numbers being withdrawals. I have a method where all deposits and withdrawals are printed:
public void showAll() {
int index=0;
while (index < auditTrail.size())
{
System.out.println(auditTrail.get(index));
index++;
}
}
However I need a method where only deposits are printed and one where only withdrawals are printed. any advice would be much appreciated.
- 02-12-2008, 04:08 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
As you title says, use two separate arrays for withdraws and deposits. You have to decide the array size, depend on your requirements.
- 02-12-2008, 05:25 PM #3
Member
- Join Date
- Feb 2008
- Posts
- 2
- Rep Power
- 0
ok, then how do i fix showAll()
- 02-13-2008, 02:29 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
Just declare an appropriate array (size and data type) inside the showAll(). You can pass all required data from outside.
Similar Threads
-
Question mark colon operator question
By orchid in forum Advanced JavaReplies: 9Last Post: 12-19-2010, 08:49 AM -
Arrays
By bunbun in forum New To JavaReplies: 1Last Post: 04-09-2008, 02:24 AM -
2D-Arrays
By kbyrne in forum New To JavaReplies: 1Last Post: 02-07-2008, 10:08 PM -
arrays help
By Warren in forum New To JavaReplies: 6Last Post: 11-23-2007, 07:23 PM -
Question about arrays
By nhlfan in forum New To JavaReplies: 4Last Post: 11-15-2007, 11:38 AM
Bookmarks