├── .gitattributes ├── accounts.data ├── __pycache__ ├── main.cpython-36.pyc └── Account.cpython-36.pyc ├── Readme.md └── main.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /accounts.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectworldsofficial/Bank-Management-System-Project-in-Python/HEAD/accounts.data -------------------------------------------------------------------------------- /__pycache__/main.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectworldsofficial/Bank-Management-System-Project-in-Python/HEAD/__pycache__/main.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/Account.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectworldsofficial/Bank-Management-System-Project-in-Python/HEAD/__pycache__/Account.cpython-36.pyc -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | #Bank Management System Project in Python 2 | 3 | 4 | ###video Demo - https://youtu.be/H2vVmtt2K6U 5 | 6 | ***** IF YOU FIND ANY ERRORS OR ANY PROBLEMS RELATED THIS PROGRAM, FEEL FREE TO CONTACT US ***** 7 | 8 | 9 | ***** LEAVE A COMMENT IF YOU LOVED OUR WORK ***** 10 | 11 | 12 | ***** FOR MORE PROJECTS :- https://projectworlds.in/ ***** 13 | 14 | 15 | 16 | 17 | THANK YOU FOR DOWNLOADING :) -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | import os 3 | import pathlib 4 | class Account : 5 | accNo = 0 6 | name = '' 7 | deposit=0 8 | type = '' 9 | 10 | def createAccount(self): 11 | self.accNo= int(input("Enter the account no : ")) 12 | self.name = input("Enter the account holder name : ") 13 | self.type = input("Ente the type of account [C/S] : ") 14 | self.deposit = int(input("Enter The Initial amount(>=500 for Saving and >=1000 for current")) 15 | print("\n\n\nAccount Created") 16 | 17 | def showAccount(self): 18 | print("Account Number : ",self.accNo) 19 | print("Account Holder Name : ", self.name) 20 | print("Type of Account",self.type) 21 | print("Balance : ",self.deposit) 22 | 23 | def modifyAccount(self): 24 | print("Account Number : ",self.accNo) 25 | self.name = input("Modify Account Holder Name :") 26 | self.type = input("Modify type of Account :") 27 | self.deposit = int(input("Modify Balance :")) 28 | 29 | def depositAmount(self,amount): 30 | self.deposit += amount 31 | 32 | def withdrawAmount(self,amount): 33 | self.deposit -= amount 34 | 35 | def report(self): 36 | print(self.accNo, " ",self.name ," ",self.type," ", self.deposit) 37 | 38 | def getAccountNo(self): 39 | return self.accNo 40 | def getAcccountHolderName(self): 41 | return self.name 42 | def getAccountType(self): 43 | return self.type 44 | def getDeposit(self): 45 | return self.deposit 46 | 47 | 48 | def intro(): 49 | print("\t\t\t\t**********************") 50 | print("\t\t\t\tBANK MANAGEMENT SYSTEM") 51 | print("\t\t\t\t**********************") 52 | 53 | print("\t\t\t\tBrought To You By:") 54 | print("\t\t\t\tprojectworlds.in") 55 | input() 56 | 57 | 58 | 59 | def writeAccount(): 60 | account = Account() 61 | account.createAccount() 62 | writeAccountsFile(account) 63 | 64 | def displayAll(): 65 | file = pathlib.Path("accounts.data") 66 | if file.exists (): 67 | infile = open('accounts.data','rb') 68 | mylist = pickle.load(infile) 69 | for item in mylist : 70 | print(item.accNo," ", item.name, " ",item.type, " ",item.deposit ) 71 | infile.close() 72 | else : 73 | print("No records to display") 74 | 75 | 76 | def displaySp(num): 77 | file = pathlib.Path("accounts.data") 78 | if file.exists (): 79 | infile = open('accounts.data','rb') 80 | mylist = pickle.load(infile) 81 | infile.close() 82 | found = False 83 | for item in mylist : 84 | if item.accNo == num : 85 | print("Your account Balance is = ",item.deposit) 86 | found = True 87 | else : 88 | print("No records to Search") 89 | if not found : 90 | print("No existing record with this number") 91 | 92 | def depositAndWithdraw(num1,num2): 93 | file = pathlib.Path("accounts.data") 94 | if file.exists (): 95 | infile = open('accounts.data','rb') 96 | mylist = pickle.load(infile) 97 | infile.close() 98 | os.remove('accounts.data') 99 | for item in mylist : 100 | if item.accNo == num1 : 101 | if num2 == 1 : 102 | amount = int(input("Enter the amount to deposit : ")) 103 | item.deposit += amount 104 | print("Your account is updted") 105 | elif num2 == 2 : 106 | amount = int(input("Enter the amount to withdraw : ")) 107 | if amount <= item.deposit : 108 | item.deposit -=amount 109 | else : 110 | print("You cannot withdraw larger amount") 111 | 112 | else : 113 | print("No records to Search") 114 | outfile = open('newaccounts.data','wb') 115 | pickle.dump(mylist, outfile) 116 | outfile.close() 117 | os.rename('newaccounts.data', 'accounts.data') 118 | 119 | 120 | def deleteAccount(num): 121 | file = pathlib.Path("accounts.data") 122 | if file.exists (): 123 | infile = open('accounts.data','rb') 124 | oldlist = pickle.load(infile) 125 | infile.close() 126 | newlist = [] 127 | for item in oldlist : 128 | if item.accNo != num : 129 | newlist.append(item) 130 | os.remove('accounts.data') 131 | outfile = open('newaccounts.data','wb') 132 | pickle.dump(newlist, outfile) 133 | outfile.close() 134 | os.rename('newaccounts.data', 'accounts.data') 135 | 136 | def modifyAccount(num): 137 | file = pathlib.Path("accounts.data") 138 | if file.exists (): 139 | infile = open('accounts.data','rb') 140 | oldlist = pickle.load(infile) 141 | infile.close() 142 | os.remove('accounts.data') 143 | for item in oldlist : 144 | if item.accNo == num : 145 | item.name = input("Enter the account holder name : ") 146 | item.type = input("Enter the account Type : ") 147 | item.deposit = int(input("Enter the Amount : ")) 148 | 149 | outfile = open('newaccounts.data','wb') 150 | pickle.dump(oldlist, outfile) 151 | outfile.close() 152 | os.rename('newaccounts.data', 'accounts.data') 153 | 154 | 155 | def writeAccountsFile(account) : 156 | 157 | file = pathlib.Path("accounts.data") 158 | if file.exists (): 159 | infile = open('accounts.data','rb') 160 | oldlist = pickle.load(infile) 161 | oldlist.append(account) 162 | infile.close() 163 | os.remove('accounts.data') 164 | else : 165 | oldlist = [account] 166 | outfile = open('newaccounts.data','wb') 167 | pickle.dump(oldlist, outfile) 168 | outfile.close() 169 | os.rename('newaccounts.data', 'accounts.data') 170 | 171 | 172 | # start of the program 173 | ch='' 174 | num=0 175 | intro() 176 | 177 | while ch != 8: 178 | #system("cls"); 179 | print("\tMAIN MENU") 180 | print("\t1. NEW ACCOUNT") 181 | print("\t2. DEPOSIT AMOUNT") 182 | print("\t3. WITHDRAW AMOUNT") 183 | print("\t4. BALANCE ENQUIRY") 184 | print("\t5. ALL ACCOUNT HOLDER LIST") 185 | print("\t6. CLOSE AN ACCOUNT") 186 | print("\t7. MODIFY AN ACCOUNT") 187 | print("\t8. EXIT") 188 | print("\tSelect Your Option (1-8) ") 189 | ch = input() 190 | #system("cls"); 191 | 192 | if ch == '1': 193 | writeAccount() 194 | elif ch =='2': 195 | num = int(input("\tEnter The account No. : ")) 196 | depositAndWithdraw(num, 1) 197 | elif ch == '3': 198 | num = int(input("\tEnter The account No. : ")) 199 | depositAndWithdraw(num, 2) 200 | elif ch == '4': 201 | num = int(input("\tEnter The account No. : ")) 202 | displaySp(num) 203 | elif ch == '5': 204 | displayAll(); 205 | elif ch == '6': 206 | num =int(input("\tEnter The account No. : ")) 207 | deleteAccount(num) 208 | elif ch == '7': 209 | num = int(input("\tEnter The account No. : ")) 210 | modifyAccount(num) 211 | elif ch == '8': 212 | print("\tThanks for using bank managemnt system") 213 | break 214 | else : 215 | print("Invalid choice") 216 | 217 | ch = input("Enter your choice : ") 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | --------------------------------------------------------------------------------