• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Transferring money between two accounts using a driver and blueprint class

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically this is the assignment:
Modify the Account class to provide a service that allows funds to be transferred from one account to another.
Note that a transfer can be thought of as withdrawing money from one account and depositing to another (for full credit, have your transfer method invoke the withdraw and deposit methods appropriately).
Modify the main method of the Transactions class to demonstrate this new service.
Here's a prototype / header for the new transfer method of the Account class:
public void transfer (Account acctToWithdrawFrom, double amountToTransfer, double fee)
// NB: The fee is charged to the account from which the amount is withdrawn.


i've add


to the driver class/ transactions


and

public void transfer (Account acctToWithdrawFrom, double amountToTransfer, double fee)
{
this.withdraw (amountToTransfer, fee);
this.deposit (amountToTransfer);

}

to the blueprint class (accounts)

clearly it's wrong but an someone help me? Thanks in advance



Account class



 
Ranch Hand
Posts: 115
11
IntelliJ IDE Clojure Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Samuel King wrote:

...

clearly it's wrong but an someone help me? Thanks in advance


Look at the parameters of that method. You aren't using all of them. You probably should be if you want to transfer money between accounts.

Why do you think it's wrong? You haven't given any errors and I don't see any expected values anywhere in the code you posted, so what has you stumped?

 
Samuel King
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm really not sure
Which parenthesis am I not using?
 
Marshal
Posts: 80472
455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
He didn't say parenthesis. He said parameter.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic