Results 1 to 4 of 4
  1. #1
    broganm1 is offline Member
    Join Date
    Feb 2008
    Posts
    2
    Rep Power
    0

    Exclamation 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.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    As you title says, use two separate arrays for withdraws and deposits. You have to decide the array size, depend on your requirements.

  3. #3
    broganm1 is offline Member
    Join Date
    Feb 2008
    Posts
    2
    Rep Power
    0

    Default

    ok, then how do i fix showAll()

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Question mark colon operator question
    By orchid in forum Advanced Java
    Replies: 9
    Last Post: 12-19-2010, 08:49 AM
  2. Arrays
    By bunbun in forum New To Java
    Replies: 1
    Last Post: 04-09-2008, 02:24 AM
  3. 2D-Arrays
    By kbyrne in forum New To Java
    Replies: 1
    Last Post: 02-07-2008, 10:08 PM
  4. arrays help
    By Warren in forum New To Java
    Replies: 6
    Last Post: 11-23-2007, 07:23 PM
  5. Question about arrays
    By nhlfan in forum New To Java
    Replies: 4
    Last Post: 11-15-2007, 11:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •