Пример #1
0
    def create_account(self):
        """Function to create an account in the bank

        Args:
            None

        """
        account_type = DataValidation.check_valid_account_type("Would you like a checking or savings account? ")
        # exit create_account if user types '0' without proceeding to first_name prompt
        if not account_type:
            return None
        first_name = DataValidation.check_valid_name("What is your first name? ")
        # exit create_account if user types '0' without proceeding to last_name prompt
        if not first_name:
            return None
        last_name = DataValidation.check_valid_name("What is your last name? ")
        # exit create_account if user types '0' without proceeding to ssn prompt
        if not last_name:
            return None
        ssn = DataValidation.check_valid_ssn("What is your social security number? ")
        # exit create_account if user types '0' without proceeding to initial deposit prompt
        if not ssn:
            return None
        initial_deposit = DataValidation.get_valid_initial_deposit(account_type, "What is your initial deposit? ")
        # exit create_account if user types '0' without proceeding to instanciate account
        if not initial_deposit:
            return None

        # create account and add customer to bank
        account = self.bank.add_account(initial_deposit, account_type)
        customer = Customer(first_name, last_name, ssn, account)
        self.bank.add_customer(customer)
Пример #2
0
    def make_withdrawal(self):
        """Function to withdraw money from an account in the bank

        Args:
            None

        """
        customer = self.bank.select_customer()
        # exit make_withdrawal if user types '0' without proceeding to withdrawal prompt
        if not customer:
            return None

        # give customer ability to exit if they do not want to incur fee
        proceed = DataValidation.check_valid_yes_no("Withdrawals incur a $5.00 fee, would you like to proceed? (Y/N) ")

        # exit make_deposit if user types '0' without proceeding to deposit prompt
        if not proceed:
            return None

        # select customer's account, display current balances, and prompt for withdrawal amount
        account = customer.account
        account.print_balance()
        amount = DataValidation.check_positive_float("How much would you like to withdraw? ")

        # exit make_deposit if user types '0' without proceeding to withdrawal prompt
        if not amount:
            return None

        # withdraw amount from account
        account.withdraw(amount)

        return None
Пример #3
0
    def make_deposit(self):
        """Function to make a deposit into a customer's account

        Args:
            None

        """
        customer = self.bank.select_customer()
        # exit make_deposit if user types '0' without proceeding to deposit prompt
        if not customer:
            return None

        # select customer's account, display current balances, and prompt for deposit amount
        account = customer.account
        account.print_balance()
        amount = DataValidation.check_positive_float("How much would you like to deposit? ")

        # exit make_deposit if user types '0' without proceeding to deposit prompt
        if not amount:
            return None

        # deposit amount into account
        account.deposit(amount)

        return None