// @topic T11718 MVC Demo - Account Balance // @brief Use Case Controller class package banking; public class ControllerTransaction { // data attributes MainWindow mainWindow; WindowAccountBalance balanceWindow; Account account; // constructors public ControllerTransaction(Account account) { this.account = account; account.setController(this); } // operations public void setBalanceWindow(WindowAccountBalance balanceWindow) { this.balanceWindow = balanceWindow; } public void balanceChanged( double balance ) { mainWindow.updateBalance( balance ); balanceWindow.updateBalance( balance ); } public MainWindow getMainWindow() { return mainWindow; } public void setMainWindow(MainWindow mainWindow) { this.mainWindow = mainWindow; } public double checkBalance() { balanceWindow.updateBalance(account.getBalance()); return account.getBalance(); } public void makeDeposit( double amount ) { account.deposit(amount); } public void makeWithdrawal(double amount) { account.withdraw( amount ); } }//class ControllerTransaction