Beispiel #1
0
        public void OpenAccount(string type) // CREATES A NEW ACCOUNT & ADDS TO THE LIST
        {
            Account newAccount = new Account();

            newAccount.transactions = new List <Transaction>();

            // creates unique account number, based on time and date
            DateTime dt = DateTime.Now;

            newAccount.Number        = dt.ToString("yyyyMMddHHmmss");
            newAccount.Type          = type;
            newAccount.Rate          = type == "Saving" ? 1.5 : 0;
            newAccount.OwnerName     = name;
            newAccount.OwnerLastName = lastName;
            newAccount.Funds         = 0;
            Console.ForegroundColor  = ConsoleColor.Red;
            Console.WriteLine($"----------------------------------");
            Console.WriteLine($"Your New Account #: {newAccount.Number}");
            Console.WriteLine($"              Type: {newAccount.Type}");
            Console.WriteLine($"      Interst Rate: {newAccount.Rate}%");
            Console.WriteLine($"----------------------------------\n");
            Console.ResetColor();
            newAccount.AddTransaction(0, "OPEN"); // ADDS "OPEN" TRANSACTION
            allAccounts.Add(newAccount);
        }