I also want to keep track of all the transactions made on an
account.
How could I implement that?
I am compiling this program with an existing java program:
- public class account
- {
- private double balance;
- private String owner;
- public account(double x, String s) { balance=x; owner=s; }
- public String owner() { return owner; }
- public void withdraw(double a) { balance -= a; }
- public void deposit(double a) { balance += a; }
- public void printbalance() { System.out.println(balance); }
-
-
- public static void main(String[] argv)
- {
- account a1 = new account(2000,"you boss");
- account a2 = new account(1000,"me nerd");
- a1.deposit(400);
- a2.withdraw(400);
- a2.withdraw(300);
- a1.printbalance();
- a2.printbalance();
- }
- }
I would appreciate your help. Thank you.