static void Main(string[] args) { ATM a = new ATM(); List <Account> accounts = a.Accounts; foreach (Account acc in accounts) { Console.WriteLine(acc.Name); } a.CheckBalance(); a.Logout(); a.Login("Joey", "123456"); a.CheckBalance(); a.Deposit(2000); a.CheckBalance(); a.Login("asdfghj", "12345678"); a.Logout(); }
public static void AtmGreetingAndLogic() { ATM atm = new ATM(); // have to create the atm object NON Static methods MUST be tied to an object string name, password; // need the object to use the non static method Console.WriteLine("Welcome to the crappy atm! "); Console.WriteLine("Please register "); // testing the functionaility of the classes Console.Write("Name: "); name = Console.ReadLine(); Console.WriteLine("Password: "******"Please Login "); name = GetUserInput("Enter Username: "******"Enter password please "); atm.Login(name, password); //atm.Register(GetUserInput("Enter Name: "), GetUserInput("Enter password: "******"Make a selection: "); // 1. checkbalance if (response == "1") { atm.CheckBalance(); } // 2. deposit if (response == "2") { Console.WriteLine("How much would you like to deposit? "); double depositedAmount = Convert.ToDouble(Console.ReadLine()); atm.Deposit(depositedAmount); Console.WriteLine($"You deposited {depositedAmount}"); atm.CheckBalance(); } // 3 Withdraw if (response == "3") { Console.WriteLine("How much would you like to withdraw? "); double withdrawnAmount = Convert.ToDouble(Console.ReadLine()); atm.Withdraw(withdrawnAmount); Console.WriteLine($"You withdrew {Math.Round(withdrawnAmount, 2)}"); atm.CheckBalance(); } if (response == "4") { Console.WriteLine("Exiting the program"); Environment.Exit(0); } } } }