Program to store the details multiple employees

0 votes

Can you please share a code to develop a bank project program to store the details multiple employees ??

Feb 12 in Python by Junaid
13 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
import random
class Bank:
      def __init__(self):
            self.dic={}
            self.acctno=random.randrange(10000,100000,1)
      def newAccount(self):
            print("Enter your name")
            self.name=input()
            self.dic[self.name]={}
            print("Enter the initial deposite ")
            self.initAmount=int(input())
            self.dic[self.name][self.acctno]=self.initAmount
      def display(self):
            print("Account creation has been successful. Your account number is ",self.acctno)
            print()
            print()
      def existing(self,nam,actno):
            self.nam=nam
            self.actno=actno
            if self.dic[self.nam][self.actno] >=0:
                  print("Authentication Successfull")
                  print()
                  return True
            else:
                  print("Authentication Failed")
                  print()
                  return False
      def withdrawal(self,nam,actno):
            print("Enter a withdrawal amount ")
            self.wit=int(input())
            self.nam=nam
            self.actno=actno
            if self.dic[self.nam][self.actno]>=self.wit:
                  self.dic[self.nam][self.actno]=self.dic[self.nam][self.actno]-self.wit
                  print("Withdrawal was successful.")
                  print("Available balance : ",self.dic[self.nam][self.actno])
                  print()
            else:
                  print("Insufficient balance ")
                  print()
      def addamount(self,nam,actno):
            self.nam=nam
            self.actno=actno
            print("Enter the amount you want to deposite ")
            self.add=int(input())
            print()
            self.dic[self.nam][self.actno]=self.dic[self.nam][self.actno]+self.add
            print("Deposite was successful.")
            print("Available balance ",self.dic[self.nam][self.actno])
      def displaybalance(self,nam,actno):
            self.nam=nam
            self.actno=actno
            print("Available balance ",self.dic[self.nam][self.actno])
            
                  
bank=Bank()

while True:
      print("Enter 1 to create a new account ")
      print("Enter 2 to access Existing account ")
      print("Enter 3 to exit ")
      userchoice=int(input())
      if userchoice==1:
            newaccount=bank.newAccount()
            bank.display()
      elif userchoice==2:
            print("Enter your name ")
            nam=input()
            print("Enter your account number")
            actno=int(input())
            boolean=bank.existing(nam,actno)
            if boolean:
                  while True:
                        print("Enter 1 to withdraw ")
                        print("Enter 2 to deposite ")
                        print("Enter 3 to display available balance ")
                        print("Enter 4 to go back to the previous menu ")
                        userinput=int(input())
                        if userinput==1:
                              bank.withdrawal(nam,actno)
                        elif userinput==2:
                              bank.addamount(nam,actno)
                        elif userinput==3:
                              bank.displaybalance(nam,actno)
                        elif userinput==4:
                              break
            else:
                  continue
                  
      elif userchoice==3:
            exit()
answered Feb 12 by Omkar
• 66,050 points

Related Questions In Python

0 votes
2 answers

How to run the Python program forever?

No, you can use while: pass I ...READ MORE

answered May 20 in Python by Lehan
321 views
+1 vote
2 answers

How to resize the image canvas to maintain a square aspect ratio

down voteacceptedUsing OpenCVYou can use resize() in OpenCV to ...READ MORE

answered Apr 4, 2018 in Python by charlie_brown
• 7,710 points
117 views
+3 votes
5 answers

How to read multiple data files in python

Firstly we will import pandas to read ...READ MORE

answered Apr 6, 2018 in Python by DeepCoder786
• 1,700 points
533 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
27 views
+4 votes
6 answers
0 votes
1 answer

Python program to read the excel file which contains more than 65K records

Hi @Rashmi! I read your code and there ...READ MORE

answered Feb 8 in Python by Omkar
• 66,050 points
19 views
0 votes
1 answer

How to print a message or the error if a file is not found?

To print the message that file is not ...READ MORE

answered Jan 2 in Python by Omkar
• 66,050 points
10 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.