Results 1 to 4 of 4
  1. #1
    vividcooper is offline Member
    Join Date
    Jan 2010
    Posts
    10
    Rep Power
    0

    Wink Transfer from one account to another

    Hi, I m doing a banking project and I need to make a transfer from one account to another. Example moving 100euros from current to savings.
    can anyone explain me few points in java statements of how can i do this.
    I am using inheritance i.e having a major class called Acount and 2 other classes (savings and current) inheriting its properties (but the savings account i am setting the interest rate while in curent no interest is given)
    thank you

  2. #2
    Lil_Aziz1's Avatar
    Lil_Aziz1 is offline Senior Member
    Join Date
    Dec 2009
    Location
    United States
    Posts
    343
    Rep Power
    5

    Default

    I think the clone() method in the Object class is what you're looking for.
    "Experience is what you get when you don't get what you want" (Dan Stanford)
    "Rise and rise again until lambs become lions" (Robin Hood)

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    I'm not so sure about using Clone here. What you are doing is transferring currency from one account to another, not Cloning an Account object. What you need to do here methinks is give accounts addFunds(...) and removeFunds(...) methods. Then if you want to transfer money from savings into checking you would do something like:

    Java Code:
    long amount = 500L;
    mySavings.removeFunds(amount);
    myCheckingAcct.addFunds(amount);
    Or some such code.
    Last edited by Fubarable; 01-26-2010 at 11:44 PM.

  4. #4
    Lil_Aziz1's Avatar
    Lil_Aziz1 is offline Senior Member
    Join Date
    Dec 2009
    Location
    United States
    Posts
    343
    Rep Power
    5

    Default

    Oh like transfering money from one account to another. In that case, completely ignore post #2 and listen to Fubarable lol.
    "Experience is what you get when you don't get what you want" (Dan Stanford)
    "Rise and rise again until lambs become lions" (Robin Hood)

Similar Threads

  1. Search Array for Account Number Link
    By Ryujin89 in forum Reviews / Advertising
    Replies: 0
    Last Post: 11-02-2009, 09:45 AM
  2. Folder Creation On Shared Hosting Account
    By arpitgadle in forum Java Servlet
    Replies: 2
    Last Post: 10-03-2009, 03:04 PM
  3. validating account
    By ServletEst in forum Java Servlet
    Replies: 3
    Last Post: 08-24-2009, 02:11 PM
  4. Using java to access internet account
    By elgem in forum Advanced Java
    Replies: 3
    Last Post: 01-18-2009, 07:49 PM
  5. Account mix problem
    By nihongbin in forum Threads and Synchronization
    Replies: 3
    Last Post: 12-10-2008, 06:05 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
  •