0% found this document useful (0 votes)
13 views11 pages

Banking Application Lab Report

The lab report details the development of a Banking Application using Python, focusing on various account classes such as Account, SavingAccount, CurrentAccount, and BusinessAccount. It outlines the implementation of core banking functionalities, user interactions, and error handling within the system. The report also describes the system's user-friendly interface for managing accounts, including options for opening accounts, depositing, withdrawing, and viewing account details.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views11 pages

Banking Application Lab Report

The lab report details the development of a Banking Application using Python, focusing on various account classes such as Account, SavingAccount, CurrentAccount, and BusinessAccount. It outlines the implementation of core banking functionalities, user interactions, and error handling within the system. The report also describes the system's user-friendly interface for managing accounts, including options for opening accounts, depositing, withdrawing, and viewing account details.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

University of Information Technology

and Sciences (UITS)


Department of Information Technology

design pattern lab report


IT 324 : design pattern Lab

Lab Report

Submitted To: Submitted By:


Barsha Roy Name: Ankon Bose
Lecturer, Student ID: 2114955003
Department of IT, UITS Name: Shohanul Islam
Email : Student ID:2114955005
barsharoy@[Link] Name: Arnob Podder
Student ID: 2114955004
Name: Sangita Alam Mim
Student
ID:0432220005191009
Lab Report sangita

December 1, 2024

Department of IT, UITS © All rights reserved.

2
Lab Report sangita

Contents
1 Problem Statement 2

2 Code for Module 2

3 Description of Implementation 6

4 Output 6

5 Module’s Working Procedure 8

1
Lab Report sangita

1 Problem Statement
Creating a Banking Application

2 Code for Module


This lab report contain Python codes.
Code for account class
1 class Account :
2 def __init__ ( self , account_number , user_name , balance ,
account_type ) :
3 self . account_number = account_number
4 self . user_name = user_name
5 self . balance = balance
6 self . account_type = account_type
7
8
9 def display ( self ) :
10 print ( " Account Details : " )
11 # print ( f " Account Number : { self . account_number }")
12 print ( f " User Name : { self . user_name } " )
13 print ( f " Balance : { self . balance } " )
14
15 def deposit ( self , amount ) :
16 self . balance = self . balance + amount
17
18 def get_balance ( self ) :
19 return self . balance
20
21 def withdraw ( self , amount ) :
22 if amount < self . balance :
23 self . balance -= amount
24 return amount
25 else :
26 print ( " Insufficient Balance " )

Code for saving account class


1 from account import Account
2
3
4 class SavingAccount ( Account ) :
5 def __init__ ( self , account_number , user_name , balance , account_type
, interest = 0.03) :
6 super () . __init__ ( account_number , user_name , balance ,
account_type )
7 self . interest = interest

2
Lab Report sangita

Code for current account class


1 from account import Account
2
3 class CurrentAccount ( Account ) :
4 def __init__ ( self , account_number , user_name , balance ,
account_type , withdraw_limit =50000) :
5 super () . __init__ ( account_number , user_name , balance ,
account_type )
6 self . withdraw_limit = withdraw_limit
7

8 def withdraw ( self , amount ) :


9 if amount <= self . balance and amount <= self . withdraw_limit
:
10 self . balance -= amount
11 return amount
12 else :
13 print ( " Exceeds withdraw limit or insufficient funds ! " )
14 return 0

Code for business account class


1 from account import Account
2
3 class BusinessAccount ( Account ) :
4 def __init__ ( self , account_number , user_name , balance ,
account_type , transaction_fee =50) :
5 super () . __init__ ( account_number , user_name , balance ,
account_type )
6 self . transaction_fee = transaction_fee
7
8 def withdraw ( self , amount ) :
9 total_amount = amount + self . transaction_fee
10 if total_amount <= self . balance :
11 self . balance -= total_amount
12 return amount
13 else :
14 print ( " Insufficient Balance ( including transaction fee )
!")
15 return 0

Code for main class


1 from saving_account import SavingAccount
2 from current_account import CurrentAccount
3 from business_account import BusinessAccount
4
5

6 import random
7
8 accounts = {}
9

3
Lab Report sangita

10 def g e n e r a t e _ a c c o u n t _ n u m b e r () :
11 return random . randint (10000 , 99999)
12
13 def main () :
14 print ( " \ nWelcome to Bank Management System ! " )
15
16 while True :
17 print ( " \ n1 . Open an Account " )
18 print ( " 2. Deposit Money " )
19 print ( " 3. Withdraw Money " )
20 print ( " 4. Display Account Details " )
21 print ( " 5. Exit " )
22
23 try :
24 choice = int ( input ( " Enter your choice : " ) )
25 except ValueError :
26 print ( " Invalid input ! Please enter a valid number . " )
27 continue
28
29 if choice == 1:
30 username = input ( " Enter your banking user name : " )
31 account_number = g e n e r a t e _ a c c o u n t _ n u m b e r ()
32 account_type = int ( input ( " Enter Account Type :\ n1 .
Savings Account \ n2 . Current Account \ n3 . Business Account \ n : - " ) )
33
34 if account_type == 1:
35 account = SavingAccount ( account_number , username ,
0 , " Savings " )
36 elif account_type == 2:
37 account = CurrentAccount ( account_number , username ,
0 , " Current " )
38 elif account_type == 3:
39 account = BusinessAccount ( account_number , username ,
0 , " Business " )
40 else :
41 print ( " Invalid Account Type ! Please try again . " )
42 continue
43

44 accounts [ account_number ] = account


45 print ( f " Account Created Successfully ! Your Account
Number is { account_number } " )
46
47 elif choice == 2:
48 acc_num = int ( input ( " Enter your account number : " ) )
49 if acc_num in accounts :
50 amount = float ( input ( " Enter amount to deposit : " ) )
51 accounts [ acc_num ]. deposit ( amount )
52 print ( " Deposit Successful ! " )
53 else :
54 print ( " Account not found ! " )
55

4
Lab Report sangita

56 elif choice == 3:
57 acc_num = int ( input ( " Enter your account number : " ) )
58 if acc_num in accounts :
59 amount = float ( input ( " Enter amount to withdraw : " ) )
60 accounts [ acc_num ]. withdraw ( amount )
61 else :
62 print ( " Account not found ! " )
63

64 elif choice == 4:
65 acc_num = int ( input ( " Enter your account number : " ) )
66 if acc_num in accounts :
67 accounts [ acc_num ]. display ()
68 else :
69 print ( " Account not found ! " )
70
71 elif choice == 5:
72 print ( " Thank you for using the Bank Management System .
Goodbye ! " )
73 break
74

75 else :
76 print ( " Invalid choice ! Please select a valid option . " )
77
78 if __name__ == " __main__ " :
79 main ()

5
Lab Report sangita

3 Description of Implementation
The Account class serves as the foundational blueprint for all account types in the
banking system. It encapsulates common attributes and methods that are shared
across different account types. The class focuses on core banking functionalities
such as depositing and withdrawing money. It ensures the encapsulation of common
operations, providing a base for specialized account types to extend and override as
necessary.
The saving account inherits from Account and introduces an additional attribute
specific to savings accounts interest. This class inherits the basic functionalities from
Account and adds the capability to calculate interest (to be implemented if needed
for advanced functionality). This class extends the Account class and introduces a
withdrawal limit to restrict the maximum amount that can be withdrawn at a time.
This class extends the Account class and introduces a withdrawal limit to restrict
the maximum amount that can be withdrawn at a time. This ensures tighter control
over withdrawals, a feature typical of current accounts.
BusinessAccount Class ( class further specializes the Account class by adding a
transaction fee for every withdrawal. It adds an additional layer of cost control by
charging a fee for withdrawals, mimicking real-world business account practices.
The [Link] file acts as the entry point for the Banking Management System. It
uses the classes defined above to provide a user interface for interacting with the
system. The system stores all accounts in a dictionary (accounts), using account
numbers as keys. Error handling ensures invalid inputs do not crash the program.
Supports seamless extension with additional account types and features.

4 Output

Figure 1: fig 1

6
Lab Report sangita

Figure 2: fig 2

Figure 3: fig 3

Figure 4: fig 4

7
Lab Report sangita

5 Module’s Working Procedure


The Banking Management System is designed to make managing accounts simple
and user-friendly. Here’s an overview of how it works:
1. Starting the System- When you launch the system, a welcome message greets
you, followed by a menu of options. You can choose what you’d like to do, such as
opening an account, depositing money, withdrawing money, viewing your account
details, or exiting the system.
2. Opening an Account- To open an account, you’ll need to enter your name and
select the type of account:
i) Savings Account: Ideal for earning interest on your balance.
ii) Current Account: Great for everyday banking with a withdrawal limit for added
security.
iii) Business Account: Perfect for businesses, with a small fee for every transaction.
The system creates a unique account number just for you, and your account is ready
to use!
3. Depositing Money- To add money to your account, simply enter your account
number and the amount you’d like to deposit.
The system confirms the deposit and updates your balance instantly.
4. Withdrawing Money- Need to withdraw cash? Just enter your account number
and the amount. Depending on your account type:
Savings Account: You can withdraw as long as there’s enough balance.
Current Account: The system ensures you stay within the allowed withdrawal limit.
Business Account: A small transaction fee is added to your withdrawal amount.
If there’s an issue, like insufficient funds or exceeding the limit, the system lets you
know right away.
5. Viewing Account Details- Curious about your account? Just enter your account
number to see details like:
Your name.
Your current balance.
Special features like your interest rate, withdrawal limit, or transaction fee. It’s a
quick and easy way to stay on top of your finances.

8
Lab Report sangita

6. Exiting the System- When you’re done, select the exit option. The system thanks
you for using it and safely shuts down.
Example of Using the System:
Opening an Account: You open a Business Account with the name Jane Smith. The
system assigns you an account number, say 54321.
Depositing Money: You deposit 5, 000intoyournewaccount.T hesystemconf irmsthedeposit, andyourb
Withdrawing Money: You withdraw 1, 000.T hesystemdeducts1,050 (including a
50transactionf ee), leavingyouwith3,950.
Checking Account Details: You check your account details and see your name,
balance, and the transaction fee information.
Exiting: You select the exit option, and the system thanks you for using the service.

Common questions

Powered by AI

To safeguard against unauthorized transactions, the banking system could integrate several security measures. Implementing authentication mechanisms such as multi-factor authentication (MFA) would add a layer of security during user login. Moreover, introducing encryption for storing and transmitting sensitive information like account numbers and balances can prevent data breaches. Implementing audit logging to track all transactions, coupled with anomaly detection algorithms, could help identify and prevent fraudulent activities. Lastly, regular security audits and vulnerability assessments should be conducted to ensure the system is resilient against evolving cyber threats .

The primary architectural purpose of the Account class in this banking system design is to serve as the foundational blueprint for different types of accounts. It encapsulates common attributes and methods such as account number, user name, balance management, and basic operations like deposit and withdraw, which can be shared across different account types. This promotes code reuse and ensures that common functionalities are centrally managed and extended as needed .

Specialized account classes such as SavingAccount, CurrentAccount, and BusinessAccount extend the functionalities of the base Account class by introducing properties and behaviors specific to each account type. The SavingAccount class introduces an additional interest attribute, allowing for interest rate calculations. The CurrentAccount incorporates a withdraw limit, adding a level of restriction typical for such accounts. Lastly, the BusinessAccount adds a transaction fee for withdrawals, thereby implementing a pseudo-cost control measure for business transactions .

Modularization plays a pivotal role in the Banking Management System by dividing the system into distinct sections such as account types and the main operation interface. Each account type (Saving, Current, Business) is encapsulated within its own class, inheriting from a base Account class, which simplifies maintenance and future enhancements. If new features or account types are needed, developers can easily extend the system by adding new modules without altering existing tested and stable code, thereby enhancing reliability and minimizing the risk of introducing bugs .

Encapsulation in the Banking Management System is portrayed by the encapsulation of account details and operations within the Account class and its subclasses. This design ensures that the internal state of an object, such as the balance and transaction methods, is only accessible through defined methods like deposit and withdraw, safeguarding against unintended modifications. Encapsulation is crucial as it maintains data integrity, hides the complexity of implementations from users (or other parts of the program), and allows developers to change internal implementations without affecting how the system interacts with those objects .

Key design considerations that facilitate the easy extensibility of the Banking Management System include the use of an object-oriented design with class inheritance, a modular codebase, and clean separation of concerns. The foundational Account class is designed to encompass common functionalities, allowing new account types to be incorporated simply by extending this base class. Moreover, the program's modular structure, with separate files for each account type and a centralized main control module, ensures that additional features or account types can be introduced without impacting the existing system, adhering to the open-closed principle of software design .

A key user interface feature that enhances the Banking Management System's usability is the use of a simple and clear text-based menu system. This provides users with straightforward options such as opening an account, making deposits, withdrawing money, checking account details, and exiting the system. The system ensures user-friendly interaction by prompting for input clearly and giving immediate feedback on actions, such as successful deposits or alerts for invalid inputs, thus lowering the learning curve for new users .

The withdrawal mechanisms vary significantly across the SavingAccount, CurrentAccount, and BusinessAccount classes. In SavingAccount, withdrawals are allowed as long as the requested amount is less than or equal to the balance, making it flexible for personal use. CurrentAccount adds a withdraw limit to this mechanism, meaning only a certain amount can be withdrawn at a time, which is suitable for managing daily expenses while maintaining security. BusinessAccount introduces a transaction fee for each withdrawal, reflecting real-world practices where business accounts handle high volumes of transactions with fees to minimize operational cost burdens. These differences suggest that SavingAccounts are more suitable for savings with occasional access, CurrentAccounts for everyday usage with regulated cash flow, and BusinessAccounts for frequent business transactions with a focus on cost awareness .

The inheritance structure of the program aids in implementing a polymorphic banking system by allowing derived account classes (SavingAccount, CurrentAccount, BusinessAccount) to inherit common functionalities from the base Account class while also enabling them to define their unique behaviors. This structure permits the application to treat objects of different specialized account types through their base class references while differing in functionality implementation, such as varying withdrawal behaviors. Consequently, this supports the open-closed principle where the system can be extended with new functionalities through inheritance without modifying existing code, a hallmark of polymorphism in object-oriented design .

The system handles errors by utilizing basic error-checking mechanisms. For instance, when a user makes a choice from the menu, the system wraps the input logic in a try-except block to catch ValueError exceptions, prompting users with an 'Invalid input' message and asking them to enter a valid number if their input is inappropriate. This ensures that the program does not crash due to unexpected inputs and enhances the robustness of the user interface .

You might also like