public class Trans {
private Operation op; /*Deposit or Withdrawal*/
private Account acc; /*account for which a transaction*/
/*amount of money involved in that transaction, deposit or withdrawal*/
private double amt;
public Trans(Account acct, Operation op, double amt) {
this.acc = acc;
this.op = op;
this.amt = amt;
}
public double getAmount() {
return amt;
}
public static void main(String[] args) {
// What is the type of Operation.WITHDRAWAL?
// If is is an int you'll hava to change the Trans
// constructor to:
// public Trans(Account acct, int op, double amt)
Trans t1 = new Trans( account1, Operation.WITHDRAWAL, 100 ) ;
// Use the variable "t1" to access fields and methods in
// this instance of Trans
System.out.println("amt = " + t1.getAmount());
}
}