static void Main(string[] args) { ATM atm = new ATM(); while (true) { Console.WriteLine("Menu"); Console.WriteLine("1.Create Account"); Console.WriteLine("2.ATM"); Console.Write("Please enter your selections: "); int select = int.Parse(Console.ReadLine()); switch (select) { case 1: atm.CreateAccount(); break; case 2: atm.Deposit(); break; default: Console.WriteLine("Invalid selection!"); break; } } }
private void refillMachineButtons_Click(object sender, EventArgs e) { ATM a = ATM.GetInstance(); Cash dc = a.CashInDispenser(); Worker w = atMachine as Worker; Cash refillAmt = w.RefillATM(dc); a.Deposit(refillAmt); FillPersonInfo(); UpdateATMInfo(); ChangeTab(ATM.GetInstance().CurrentScreen); }
static void Main(string[] args) { ATM atm = new ATM(); Console.WriteLine("Olá, digite o valor do saque:"); int Withdraw = Convert.ToInt32(Console.ReadLine()); atm.calculateNotes(Withdraw); atm.ViewBalance(); atm.Deposit(1000); atm.ViewBalance(); }
private void startPanel_ControlAdded(object sender, ControlEventArgs e) { switch (e.Control) { case UCChooseCardAction form: form.ToggleDeposit(atm.IsDepositAvailable); form.ToggleWithdraw(atm.IsWithdrawAvailable); break; case UCChooseFaceValue form: form.SetAvailableBanknotes((amount, banknote) => atm.GetAvailableBanknotes(amount, banknote)); break; case UCEnterDepositFaceValues form: form.RemainingBanknotesQuantity = atm.RemainingDepositBanknotesQuantity; break; case UCConfirmOperation form: form.OnDeposit = (totalSum, banknotesQuantity) => atm.Deposit(totalSum, banknotesQuantity); form.OnWithdraw = (banknotes) => atm.Withdraw(banknotes); break; } }
public static void Menu(List <Account> listOfAccounts, Account currentAccount) { int userChoice; string usernameEntry; string passwordEntry; int withdrawDepositEntry; Console.WriteLine("What would you like to do?: \n" + "[1] Register an Account \n" + "[2] Login \n"); userChoice = int.Parse(Console.ReadLine()); if (userChoice == 1) { Console.WriteLine("Enter your username \n"); usernameEntry = Console.ReadLine(); Console.WriteLine("\nEnter your password \n"); passwordEntry = Console.ReadLine(); ATM.Register(usernameEntry, passwordEntry, listOfAccounts); } else if (userChoice == 2) { Console.WriteLine("Enter your username \n"); usernameEntry = Console.ReadLine(); Console.WriteLine("\nEnter your password \n"); passwordEntry = Console.ReadLine(); currentAccount = ATM.Login(usernameEntry, passwordEntry, listOfAccounts, currentAccount); } else { Console.WriteLine("Error enter a valid selection"); Console.Clear(); } if (currentAccount.Name != null && currentAccount.Password != null) { while (currentAccount.Name != null && currentAccount.Password != null) { { Console.WriteLine("What would you like to do?: \n" + "[1] Logout \n" + "[2] Show Current Balance \n" + "[3] Deposit \n" + "[4} Withdraw \n"); userChoice = int.Parse(Console.ReadLine()); if (userChoice == 1) { Console.Clear(); currentAccount = ATM.Logout(currentAccount); } else if (userChoice == 2) { ATM.CheckBalance(currentAccount); } else if (userChoice == 3) { Console.WriteLine("How much would you like to deposit? \n"); withdrawDepositEntry = int.Parse(Console.ReadLine()); currentAccount = ATM.Deposit(withdrawDepositEntry, currentAccount); } else if (userChoice == 4) { Console.WriteLine("How much would you like to withdraw? \n"); withdrawDepositEntry = int.Parse(Console.ReadLine()); currentAccount = ATM.Withdraw(withdrawDepositEntry, currentAccount); } } } } }