Results 1 to 4 of 4
- 01-26-2010, 07:09 PM #1Member
- Join Date
- Jan 2010
- Rep Power
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)
- 01-26-2010, 10:25 PM #2
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)
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:
long amount = 500L; mySavings.removeFunds(amount); myCheckingAcct.addFunds(amount);
Last edited by Fubarable; 01-26-2010 at 10:44 PM.
- 01-26-2010, 10:43 PM #4
- By Ryujin89 in forum Reviews / AdvertisingReplies: 0Last Post: 11-02-2009, 08:45 AM
- By arpitgadle in forum Java ServletReplies: 2Last Post: 10-03-2009, 02:04 PM
- By ServletEst in forum Java ServletReplies: 3Last Post: 08-24-2009, 01:11 PM
- By elgem in forum Advanced JavaReplies: 3Last Post: 01-18-2009, 06:49 PM
- By nihongbin in forum Threads and SynchronizationReplies: 3Last Post: 12-10-2008, 05:05 AM