예제 #1
0
        private static void SavingsOperations(Account user)
        {
            Savings savings = new Savings();

            Console.WriteLine("Welcome " + user.Name);
            Console.WriteLine("What would you like to do? \n");

            Console.WriteLine("1. Make a Deposit");

            Console.WriteLine("2. Withdraw Money");

            Console.WriteLine("3. Check Account Balance");

            string userInput = Console.ReadLine();

            if (userInput.Equals("1"))
            {
                Console.WriteLine("How much you wan deposit?");
                int amount = Convert.ToInt32(Console.ReadLine());

                savings.Deposit(user, amount);
            }
            else if (userInput.Equals("2"))
            {
                Console.WriteLine("How much you wan commot?");
                int amount = Convert.ToInt32(Console.ReadLine());

                savings.Withdraw(user, amount);
            }
            else if (userInput.Equals("3"))
            {
                savings.GetAccountBalance(user);
            }
        }
예제 #2
0
        public static Account ReturnAccountType(string account_type, string name, DateTime birthdate, string gender, string mail_address, int phone_number, string password)
        {
            Random random = new Random();

            if (account_type.Equals("1"))
            {
                var savings = new Savings()
                {
                    Name            = name,
                    Birthdate       = birthdate,
                    Gender          = gender,
                    Mail            = mail_address,
                    PhoneNumber     = phone_number,
                    AccountPassword = password,
                    AccountBalance  = 0.0,
                    AccountNumber   = "02" + Convert.ToInt32(random.Next(19999999, 99999999)),
                    AccountType     = "Savings"
                };
                return(savings);
            }
            else if (account_type.Equals("2"))
            {
                var current = new Current()
                {
                    Name            = name,
                    Birthdate       = birthdate,
                    Gender          = gender,
                    Mail            = mail_address,
                    PhoneNumber     = phone_number,
                    AccountPassword = password,
                    AccountBalance  = 0.0,
                    AccountNumber   = "02" + Convert.ToInt32(random.Next(19999999, 99999999)),
                    AccountType     = "Current"
                };
                return(current);
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        public List <Account> ExistingAccounts()
        {
            var account1 = new Savings()
            {
                AccountNumber   = "0289281828",
                AccountPassword = "******",
                Gender          = "Male",
                Mail            = "*****@*****.**",
                Name            = "Samuel Olagesin",
                PhoneNumber     = 0921929391,
                AccountBalance  = 89000
            };

            var account2 = new Savings()
            {
                AccountNumber   = "0289281128",
                AccountPassword = "******",
                Gender          = "Female",
                Mail            = "*****@*****.**",
                Name            = "Sharon Olagesin",
                PhoneNumber     = 0921929391
            };

            var account3 = new Current()
            {
                AccountNumber   = "0289199828",
                AccountPassword = "******",
                Gender          = "Female",
                Mail            = "*****@*****.**",
                Name            = "stephanie Olagesin",
                PhoneNumber     = 0921929391
            };

            var customers = new List <Account>();

            customers.Add(account1);
            customers.Add(account2);
            customers.Add(account3);

            return(customers);
        }