def run(): while True: choice = view.welcome_menu() if choice == "1": #Create an account username = view.get_username() pin = view.get_pin() balance = view.amount() new_account = Account(username) new_account.pin = pin new_account.balance = balance new_account.save() main_menu(new_account) elif choice == "2": #login username = view.get_username() pin = view.get_pin() account = Account.login(username, pin) if not account: view.error() else: main_menu(account) elif choice == "3": #exit return else: view.bad_input()
def main_menu(): while True: view.show_menu() selection = view.get_input() if selection == "3": return elif selection == "1": new_user = view.new_account() new_account_num = model.create_new_account() new_user_full = new_user[0] + " " + new_user[1] model.add_name(new_account_num, new_user_full) model.add_pin_code(new_account_num, new_user[2]) elif selection == "2": account_num = view.get_account() account_details = model.get_account_details(account_num[0]) if str(account_num[1]) == str(account_details["pin_code"]): view.display_user_details(account_details) user_menu(account_num[0]) else: view.bad_input return else: view.bad_input()
def mainmenu(account): while True: view.show_menu(account) selection = view.get_input() if selection == '4': answer = view.quit_input() if answer == "y": model.save() break if answer == "n": view.show_menu(account) elif selection == '1': balance = model.check_balance(account) view.show_balance(balance) elif selection == '2': depbalance = float(view.get_amount_input()) model.deposit(account, depbalance) balance = model.check_balance(account) view.show_balance(balance) elif selection == '3': wdbalance = float(view.get_amount_input()) model.withdraw(account, wdbalance) balance = model.check_balance(account) view.show_balance(balance) else: view.bad_input()
def secondmenu(selection2, bank): while True: if selection2 == '4': bank.save() exit() elif selection2 == '1': balance = bank.getBalance() view.check_bal(balance) secondary() elif selection2 == '2': withdr = float(view.withdraw()) bank.withdrawal(withdr) bal = bank.getBalance() view.new_bal(bal) bank.save() secondary() elif selection2 == '3': deps = float(view.deposit()) bal = bank.depositor(deps) view.new_bal(bal) bank.save() secondary() else: view.bad_input() run()
def login(): model.load() account = view.get_acct() pin = view.get_pin() if pin == model.pin_check(account, pin): mainmenu(account) else: view.bad_input()
def run(): while True: choice = view.main_menu() if choice == "3": #Exit return elif choice == "1": #Create Account view.create_account() fname = view.first_name() lname = view.last_name() pin = view.choose_pin() initial = float(view.deposit_initial()) #Create new account then display view.new_account(model.create_account(fname, lname, pin, initial)) elif choice == "2": #log in account_num, pin = view.login() #Check if login info is correct if model.login(account_num, pin) == False: view.bad_login() else: #Login Menu - Check Balance, Withdraw, Deposit, Open Savings Account info = model.login(account_num, pin) view.welcome(account_num, info) while True: choice = view.login_menu() if choice == "1": view.check_balance(info) elif choice == "2": login_withdrawal(account_num) #see line 58 elif choice == "3": num = view.deposit() new_balance = model.deposit(num, account_num) view.deposit_new_balance(num, new_balance) elif choice == "4": from_account, to_account, amount = view.transfer() #Add " account" at the end of the string so it matches the key in the dictionary from_account = from_account + " account" to_account = to_account + " account" #convert amount value from string to float amount = float(amount) info = model.transfer(from_account, to_account, amount, account_num) view.transfer_new_balance(info, from_account, to_account) elif choice == "5": yesorno, deposit = view.create_savings() model.open_savings(yesorno, float(deposit), account_num) view.savings_opened(float(deposit)) elif choice == "6": view.signout() return else: view.bad_input()
def mainmenu(student): while True: view.show_menu(student) selection = view.get_input() # print(selection) if selection == '3': model.save() return elif selection == '1': newgrade = view.get_input() model.add_grade(student, newgrade) elif selection == '2': gpa = model.get_gpa(student) view.show_gpa(gpa) else: view.bad_input()
def mainmenu(student): #basically a while loop while True: #This loop doesnt terminate on its own. The break keyword stops the loop view.show_menu(student) #Print students name @ top of menu selection = view.get_input() print(selection) if selection == '4': model.save() #save before exiting return #exits the function. could also use /br elif selection == '1': new_grade = view.get_grade() model.add_grade(student, new_grade) elif selection == '2': pass elif selection == '3': pass else: view.bad_input()
def mainmenu(student): while True: view.show_menu(student) selection = view.get_input() if selection == '4': model.save() return elif selection == '1': newgrade = view.get_grade() model.add_grade(student, newgrade) elif selection == '2': view.show_gpa(model.get_gpa(student)) elif selection == '3': student = view.get_student() model.add_student(student) else: view.bad_input()
def mainmenu(clientname, accountcheck): while True: view.show_mainmenu(clientname, accountcheck) selection = view.get_input() print(selection) if selection == '1': view.show_balance(model.get_balance(clientname)) elif selection == '3': model.add_fund(clientname, view.get_deposit()) elif selection == '2': model.withdraw(clientname, view.get_withdraw()) pass elif selection == '4': view.goodby() initialmenu() else: view.bad_input()
def main_menu(account): while True: choice = view.main_menu() if choice == "1": balance = account.balance print(balance) elif choice == "2": withdraw = view.withdraw() account.withdraw(withdraw) account.save() elif choice == "3": depo = view.deposit() account.deposit(depo) account.save() elif choice == "4": account.save() return else: view.bad_input()
def user_menu(user_account): while True: view.show_user_menu() selection = view.get_input() if selection == "4": return elif selection == "1": view.show_balance(model.get_balance(user_account)) elif selection == "2": print("wit") withdraw_amount = int(view.subtract_funds()) current_balance = int(model.get_balance(user_account)) if withdraw_amount > current_balance: print("insufficient funds") else: model.withdraw_funds(user_account, withdraw_amount) elif selection == "3": add_amount = view.add_funds() model.add_funds(user_account, add_amount) else: view.bad_input()
def secondmenu(selection2,bank): while True: if selection2 == '4': model.save() run() elif selection2 == '1': bank.getBalance(main,ac_num) elif selection2 == '2': withdr = float(view.withdraw()) bank.withdrawal(withdr) model.save() bank.getBalance() run() elif selection2 == '3': deps = float(view.deposit()) bank.depositor(deps) model.save() bank.getBalance() run() else: view.bad_input() run()
def mainmenu(selection): while True: if selection == '3': model.save() break ### this is not exiting the program elif selection == '1': firstname = view.First() lastname = view.Last() genpin = view.create_PIN() model.create_account(firstname,lastname,genpin) model.save() run() elif selection == '2': checkac = view.login_ac() checkpin = view.login_pin() if model.login_verify(checkac,checkpin) == True: secondary() else: run() else: view.bad_input() run()
def mainmenu(selection): while True: if selection == '3': bank.save() exit() elif selection == '1': firstname = view.First() lastname = view.Last() genpin = view.create_PIN() bank.create_account(firstname, lastname, genpin) bank.save() run() elif selection == '2': checkac = view.login_ac() checkpin = view.login_pin() if bank.login_verify(checkac, checkpin) == True: secondary() else: run() else: view.bad_input() run()
def initialmenu(): while True: view.show_initalmenu() selection = view.get_input() print(selection) if selection == '1': new_Firstname = view.get_FirstName() new_LastName = view.get_LastName() new_pin = view.get_pin() newaccount = model.create_account(new_Firstname, new_LastName, new_pin) model.save(newaccount) elif selection == '2': clientcheck = view.clientcheck() accountcheck = int(view.accountcheck()) pin = int(view.pincheck()) model.login(clientcheck, accountcheck, pin) mainmenu(clientcheck, accountcheck) elif selection == '3': pass else: view.bad_input()