private int DisplayMenuOfAmounts() { int userChoice = 0; int[] amounts = { 0, 20, 40, 60, 100, 200 }; while (userChoice == 0) { Clear(); Screen.DisplayMessageLine("\nWITHDRAWAL MENU: "); Screen.DisplayMessageLine("1 - $20"); Screen.DisplayMessageLine("2 - $40"); Screen.DisplayMessageLine("3 - $60"); Screen.DisplayMessageLine("4 - $100"); Screen.DisplayMessageLine("5 - $200"); Screen.DisplayMessageLine("6 - Cancel transaction"); Screen.DisplayMessage("\nChoose a withdrawal amount: "); int input = Keypad.GetInput(); switch (input) { case 1: // if the user chose a withdrawal amount case 2: // (i.e., chose option 1, 2, 3, 4 or 5), return the case 3: // corresponding amount from amounts array case 4: case 5: userChoice = amounts[input]; // save user's choice break; case CANCELED: // the user chose to cancel userChoice = CANCELED; // save user's choice break; default: // the user did not enter a value from 1-6 Screen.DisplayMessageLine("\nInvalid selection. Try again."); Sleep(2000); break; } } return(userChoice); }
public Deposit(int userAccountNumber, Screen atmScreen, BankDatabase atmBankDatabase, Keypad atmKeypad, DepositSlot atmDepositSlot) : base(userAccountNumber, atmBankDatabase, atmScreen) { keypad = atmKeypad; depositSlot = atmDepositSlot; }
const int CANCELED = 7; // Kullanıcının çekmek istediği para miktarını kendisinin belirlemesi için bir seçenek daha eklendi.(Ek özellik) public Withdrawal(int userAccount, Screen screen, BankDatabase bankDatabase, Keypad keypad, CashDispenser cashDispenser) : base(userAccount, bankDatabase, screen) { this.keypad = keypad; this.cashDispenser = cashDispenser; }