예제 #1
0
        public void viewWithdraw(User user)
        {
            string header         = "withdraw";
            string prompt         = "Check another account?";
            string withdrawPrompt = "Continue with a new withdrawal?";

            Console.Clear();
            Account account = loopSearchAccount(user, header, prompt);

            if (account != null)
            {
                int amount = withdraw(user, account, header, withdrawPrompt);
                if (amount != -1)
                {
                    Activity withdraw = account.withdraw(amount);
                    account.rebuild(fe);
                    Console.Clear();
                    display.interfaceHeader(header);
                    display.interfaceMessage("success", "You've successfully withdrawn $" + withdraw.Amount + " from account " + account.AccountNumber + ".");
                }
                Console.Clear();
                display.interfaceBankMainMenu(this, user);
            }
            else
            {
                Console.Clear();
                display.interfaceBankMainMenu(this, user);
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            Customer cust = new Customer();
            string   firstname;
            string   lastname;
            string   gender;

            Console.WriteLine("what is your first name?");
            firstname = Console.ReadLine();
            cust.setFirstName(firstname);
            Console.WriteLine("what is your last name?");
            lastname = Console.ReadLine();
            cust.setLastName(lastname);
            Console.WriteLine("what is your gender?");
            gender = Console.ReadLine();
            cust.setGender(gender);

            int    account_number;
            string account_type;
            string currency;

            Console.WriteLine("what is your account number?");
            account_number = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("what type account do you have");
            account_type = Console.ReadLine();
            Console.WriteLine("in which currency?");
            currency = Console.ReadLine();

            Account acc = new Account(account_number, account_type, currency);

            Console.WriteLine("Enter amount to deposit");
            double depositAmount;

            depositAmount = Convert.ToDouble(Console.ReadLine());
            acc.deposit(depositAmount);

            Console.WriteLine("Enter amount to withdraw");
            double withdrawAmount;

            withdrawAmount = Convert.ToDouble(Console.ReadLine());
            acc.withdraw(withdrawAmount);
        }