public override void Execute() { BankDatabase bankDatabase = base.bankDatabase; Screen screen = base.screen; decimal availableBalance = bankDatabase.getAvailableBalance(AccountNumber); decimal totalBalance = bankDatabase.getTotalBalance(AccountNumber); screen.DisplayMessageLine("Balance Information: " + "\n - Available balance: " + availableBalance + "\n - Total balance: " + totalBalance); Sleep(5000); }
public override void Execute() { BankDatabase bankDatabase = base.BankDatabase; decimal availableBalance = bankDatabase.getAvailableBalance(AccountNumber); decimal totalBalance = bankDatabase.getTotalBalance(AccountNumber); Screen.DisplayMessageLine("\nBalance Information:"); Screen.DisplayMessage(" - Available balance: "); Screen.DisplayDollarAmount(availableBalance); Screen.DisplayMessage("\n - Total balance: "); Screen.DisplayDollarAmount(totalBalance); Screen.DisplayMessageLine(string.Empty); Sleep(5000); }
public override void Execute() { bool isCashDispensed = false; decimal availableBalance; BankDatabase bankDatabase = base.bankDatabase; Screen screen = base.screen; do { amount = (decimal)displayMenu();//Method integer değer döndürdüğü için type cast yapıldı. if (amount != CANCELED) { availableBalance = bankDatabase.getAvailableBalance(AccountNumber); if (amount <= availableBalance) { if (cashDispenser.isSufficiantCashAvailable(amount)) { bankDatabase.Debit(AccountNumber, amount); cashDispenser.DispenseCash(amount); isCashDispensed = true; screen.DisplayMessageLine("\nYour cash has been dispensed. Please take your cash now."); } else { screen.DisplayMessageLine("\nInsufficient cash available in the ATM.\n\nPlease choose a smaller amount."); } } else { screen.DisplayMessage("\n Insufficient funds in your account.\n\n Please choose a smaller amount."); } Sleep(2000); } else { screen.DisplayMessageLine("\nCancelling transaction..."); Sleep(2000); return; } } while (!isCashDispensed); }
public override void Execute() { bool isCashDispensed = false; decimal availableBalance; BankDatabase bankDatabase = base.BankDatabase; do { _amount = (decimal)DisplayMenuOfAmounts(); if (_amount != CANCELED) { availableBalance = bankDatabase.getAvailableBalance(AccountNumber); if (_amount <= availableBalance) { if (CashDispenser.IsSufficiantCashAvailable(_amount)) { bankDatabase.Debit(AccountNumber, _amount); CashDispenser.DispenseCash(_amount); isCashDispensed = true; Screen.DisplayMessageLine("\nYour cash has been dispensed. Please take your cash now."); } else { Screen.DisplayMessageLine("\nInsufficient cash available in the ATM.\n\nPlease choose a smaller amount."); } } else { Screen.DisplayMessage("\nInsufficient funds in your account.\n\nPlease choose a smaller amount."); } Sleep(3000); } else { Screen.DisplayMessageLine("\nCancelling transaction..."); Sleep(3000); return; } } while (!isCashDispensed); }