public override void Execute() { BankDatabase bankDatabase = database; var AvailableBalance = bankDatabase.getAvailableBalance(AccountNumber); var TotalBalance = bankDatabase.getTotalBalance(AccountNumber); UserScreen.DisplayMessageLine("\nBalance Information"); UserScreen.DisplayMessage(" - Available Balance: "); UserScreen.DisplayDollarAmount(AvailableBalance); UserScreen.DisplayMessage("\n - Total Balance: "); UserScreen.DisplayDollarAmount(TotalBalance); UserScreen.DisplayMessageLine(""); }
public override void Execute() { bool cashDispensed = false; decimal availableBalance; BankDatabase bankDatabase = database; Screen screen = new Screen(); do { amount = (decimal)displayMenu(); if (amount != CANCELED) { availableBalance = bankDatabase.getAvailableBalance(AccountNumber); if (amount <= availableBalance) { bankDatabase.Debit(AccountNumber, amount); cashDispenser.DispenseCash(amount); cashDispensed = true; screen.DisplayMessageLine("\nYour cash has been dispensed. Please take your cash now."); } else { screen.DisplayMessageLine("\nInsufficient funds in your account. \nPlease choose a smaller amount."); } } else { screen.DisplayMessageLine("\nCanceling transaction..."); return; } } while (!cashDispensed); }