-
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.
-
As you title says, use two separate arrays for withdraws and deposits. You have to decide the array size, depend on your requirements.
-
ok, then how do i fix showAll()
-
Just declare an appropriate array (size and data type) inside the showAll(). You can pass all required data from outside.