In: Computer Science
Description:
United Bank is looking at computerizing their banking system. The users of the system will interact with it like customers use an ATM. A part of their software requirement is given below. You are required to do additional self-study on how ATM machines function and create a design for managing it.
Requirements: The system allows the creation of new accounts, authenticate account holders, and also manage credits and debits. Money can be deposited or withdrawn from an account provided the account holder gives proper authentication. When an account is opened, the details of account holders are recorded in the system’s files which includes their names, unique ids, address, account type, and phone numbers. An account can be owned by a maximum of two individuals (joint accounts). The system stores a secret alphanumeric key for each account. When the user transacts with the bank, this secret key is first required before any other transaction. Once the key is entered and verified the details of the account holder with current balance is displayed. A maximum of three attempts are allowed for entering the secret key, after which a relevant message is shown, and the user must exit the system. Uni Bank provides three types of accounts: Checking Account, Saving Account, and Business Account. A checking account provides interest rates of 3% per annum. A maximum of AED 5000 can be withdrawn in one day and there must always be a balance of AED 100 in the account. For the saving account the interest rate is 7% per annum. Only a maximum of AED 2000 can be withdrawn in one day and there must always be a balance of AED 1000 in the account. For a business account, additional information is required like business name, business registration number, and business owner name. The interest rate is 3% per annum. Only a maximum of AED 10000 can be withdrawn in one day and there must always be a balance of AED 2000 in the account.
Submission:
(1)
The given system requirement can be efficiently modeled using a good database design and a systematic backend that properly handles authentication and manages new accounts.
United Bank is looking forward to develop a software that can be embedded right into their Automated Teller Machines(ATM). The software provides users with new account registration, authentication, and withdrawal based on account type.
The authentication includes an alphanumeric key that is used to authenticate the user and provide access to banking services. The authentication allows the user to enter key up to three incorrect trials. The account types are checking, savings, and business. All three account types has its own unique attributes and methods like Interest per annum and maximum withdrawal rates.
Let's have a look at how this system can be designed and implemented.
(2)
The database design can contain 6 entities or classes with the main class being the Account_User.
The Account_User_Keys has 1-1 relation with Account_User which means one key for one user with Acc_userId being the Foreign key.
The Account_Type consists of two attributes - Single account and Joint account, to differentiate it the checking, savings, and business accounts are joint or single.
All the accounts will have an account type and Acc_userId associated to it to clearly differentiate which user has which type of account.
CLASS |
MAIN ATTRIBUTE |
---|---|
Account_User |
Acc_userId (PK) |
Account_User_Keys |
Acc_keyId(PK), Acc_userId(FK) |
Account_type |
Acc_TypeId(PK) |
Account_checking |
Acc_CheckingId(PK), Acc_Type(FK),Acc_userId(FK) |
Account_savings |
Acc_SavingsId(PK), Acc_Type(FK),Acc_userId(FK) |
Account_business |
Acc_BusinessId(PK), Acc_Type(FK),Acc_userId(FK) |
Now, let's draw a class diagram to understand the relations between entities better.
(3)
The UML diagram for the classes, attributes and relations described in question 2 is attached below:
(4)
The skeleton python code for how the class and entities should program is given in the code snippet. The code is properly formatted and documented. For any doubts please mention in the comments section.
class Account_user:
#constructor
def __init__(self,Acc_UserId,Acc_UserName):
self.user_id = Acc_UserId
self.user_name = Acc_UserName
#getter methods
def get_id(self):
return self.user_id
def get_name(self):
return self.user_name
#setter methods
def set_id(self,id):
self.user_id = id
def set_name(self,name):
self.user_name = name
#function to add_user
def add_user(self);
#code
#function to get_user
def get_user(self);
#code
#function to update_user
def update_user(self);
#code
#function to delete_user
def delete_user(self);
#code
#class Account_User_keys extends class Account_user
class Account_User_keys(Account_user):
def __init__(self,Acc_UserId,Acc_key):
super().__init__(Acc_UserId,Acc_key)
self.key = Acc_key
#code to create key
def create_key(self,key):
#code
class Account_Type():
def __init__(self,Acc_single,Acc_joint):
self.single = Acc_single
self.joint = Acc_joint
#getter methods
def get_single(self):
return self.Acc_single
def get_joint(self):
return self.Acc_joint
#setter methods
def set_id(self,single):
self.single = single
def set_name(self,joint):
self.joint = joint
#class Account_savings extends Account_user and Account_type
class Account_checking(Account_user,Account_Type):
def __init__(self,Acc_UserId,Acc_key,Acc_single,Acc_joint,balance,interest):
super().__init__(Acc_UserId,Acc_key,Acc_single,Acc_joint)
self.balance = balance
self.interest = interest
#method to get balance
def get_balance(self,Acc_UserId):
#code
#method to calculate interest
def calculate_interest(self,balance,Acc_UserId):
#code
def withdraw(self,balance,Acc_UserId):
if self.balance > 0:
#code
else
#code
class Account_savings(Account_user,Account_Type):
#same as Account_checking class
class Account_business(Account_user,Account_Type):
#same as Account_checking class
#main to test the above classes
def main():
user = Account_user()
user.set_id(1)
user.set_name('dwayne johnson')
key = Account_User_keys()
key.create_key(1)
checking = Account_checking()
checking.get_balance(1)
checking.calculate_interest(2000,1)
checking.withdraw(5000,1)
#calling main method
main()