Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- The program talk about that simulate a simple bank account that has basic account transactions.
- Assniment 3
- student number:20186164
- Written by basel abdelhadi
- Modified by: basel abdelhadi
- Date: 19/October/2019
- '''
- cust_acc = {'name': '', 'balance': ''} # Create an empty dictionary named "cust_acc" abrev. for (Customer_Accounts)
- new_acc_prompt == cust_acc # define the new_acc_prompt as a string that can be used with option 1 in the menu
- # for options 2-5 if the customer name with the account doesn't exist
- if new_acc_prompt != cust_acc : # you have to display this message : "This customer doesn't exist"
- print('This customer does not exist')
- def menu():
- ch = ''
- num = 0
- while ch != 7:
- print("\tMAIN MENU")
- print("\t1. Open an account")
- print("\t2. Close an account")
- print("\t3. Deposit money")
- print("\t4. Withdrawal money")
- print("\t5. Enquire about balance")
- print("\t6. Print a list of customers and balances")
- print("\t7. Quit")
- print("\tSelect Your Option (1-7) ")
- ch = input()
- if ch == '1':
- Open()
- elif ch =='2':
- Close()
- elif ch == '3':
- Deposit()
- elif ch == '4':
- Withdrawal()
- elif ch == '5':
- Enquire()
- elif ch == '6':
- listofcustomers()
- elif ch == '7':
- Quit()
- else :
- print("Unrecognized command")
- ch = input("Enter your choice : ")
- menu()
- # if your choice 1, open a new account, make sure the name doesn't exist
- def Open():
- new_acc_prompt = int(input('Enter Name of the new customer and the amount of money to be deposited:'))
- if new_acc_prompt != cust_acc :
- print('This customer does not exist')
- print('into the new account (Ex.''):')
- print('This customer account already exist!')
- # if your choice 2, close an account by name, make sure balance = 0 first
- def Close():
- new_acc_prompt = int(input('Enter the customer/account name to be deleted:'))
- del cust_acc['new_acc_prompt']
- if new_acc_prompt != cust_acc :
- print('This customer does not exist')
- if cust_acc > 0 :
- print('Can not close an account with balance greater than zero')
- else:
- print('This account has been deleted successfully')
- # if your choice 3, deposit money, print balance before & after deposit
- def Deposit():
- new_acc_prompt = int(input('Enter the customer name for deposit:'))
- if new_acc_prompt != cust_acc :
- print('This customer does not exist')
- d = int(input('Enter the amount to be deposited:'))
- cust_acc.balance += balance
- print('your balance is :',balance,'before deposit')
- print('your balance is :', cust_acc ,'after deposit')
- # if your choice 4, Withdrawal money, make sure you have enough balance and print balance before & after the withdrawal
- def Withdrawal():
- new_acc_prompt = int(input('Enter the customer name for withdrawal:'))
- if new_acc_prompt != cust_acc :
- print('This customer does not exist')
- w = int(input('Enter the amount to be withdrawn:'))
- print('your balance is :',balance ,'before withdrawal')
- if w > cust_acc.balance:
- print('You do not have enough balance to cover the withdrawal')
- cust_acc.balance -= balance
- print('your balance is :',balance ,'before withdrawal')
- print('your balance is :' ,cust_acc , 'after withdrawal')
- # if your choice 5, find a balance for a customer by name
- def Enquire():
- new_acc_prompt = int(input('Enter the customer name for Balance enquiry:'))
- if new_acc_prompt != cust_acc :
- print('This customer does not exist')
- print('your balance is :', cust_acc.balance )
- # if your choice is 6, print a list of customer and balances, use given formats
- def listofcustomers():
- print('No'' ''Customer'' ''Name'' ''Balance')
- # if your choice 7, exit the loop
- def Quit():
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement