TRIBHUVAN UNIVERSITY
INSTITUTE OF ENGINEERING
PULCHOWK CAMPUS
PROJECT ON
ATM BANKING SYSTEM
A course Project Submitted to the Department of Electronics and Computer
Engineering in partial fulfilment of the requirement for the practical course on
Computer Programming.
Submitted By:
Prabesh Aryal (077BCE097)
Pravab Budathoki (077BCE110)
Purushottam Simkhada (077BCE113)
Rajiv Bashyal (077BCE118)
ACKNOWLEDGEMENTS
We are overwhelmed in all humbleness and gratefulness to acknowledge our
depth to all those who have helped us to put these ideas, well above the level of
simplicity and into something concrete. We would like to express our special
thanks of gratitude to Mr. Anup Shrestha who gave us the opportunity to do this
wonderful project, which also helped us in doing a lot of Researches and
enlightened us with so many new things. Furthermore, this project created a
strong bond among us amidst the pandemic. We are really thankful to him.
Secondly, our sincere thanks goes to our seniors and beloved friends who helped
us with different means and resources throughout the project.
Any attempt at any level can’t be satisfactorily completed without the support
and guidance of parents. We would like to thank our parents and family
members who provided us a healthy, friendly and sound environment in the
course of preparing the project.
Page Break
ABSTRACT
ATM BANKING SYSTEM project is based on a concept of managing account
personally. From this system, the user can check total balance, Deposit Amount
and Withdraw Amounts easily as it is not time-consuming. The whole project is
developed in ‘C’ Programming language. Different variables and strings have been
used for the development of this project. Since this is the mini project it contains
a bit less features. It's easy to operate and understand by users.
Theory
This project is based on high level language i.e., C Programming.
C is structured programming-based computer language which was developed
by Dennis Ritchie at Bell laboratories in 1972 AD. Structured programming refers
to programming paradigm which is aimed at improving clarity, quality, and
development time of a computer program by making extensive use of structured
control flow, constructs of selection and repetition, block structures and
subroutines.
In this project we use important parts of C Programming which are control
statement, looping, function, array, structure, pointer, data file etc.
Page Break
TABLE OF CONTENTS
• Objectives 5
• Theory 6
• Algorithm 20
• Flowchart 29
• Source code 45
• Output 77
• Reference 85
Chapter 1
INTRODUCTION
This mini project is prepared by C Programming using simple logic available in
high level language of the programming. This program is concerned with checking
your bank balance, withdrawing and depositing the money. We have included
different logic statement, and if, if else as control statement and looping like: for,
while and do while statement. Also, we used strings which are a group of
similar array data types. File handling is also used to allow us to store
information permanently which can be modified whenever necessary.
1. BACKGROUND
We as a student of Civil Engineering were taught about the basic concept of
programming in high level language as a way of improving the student’s skills in
logical reasoning, application of technical knowledge, and quantitative
problem solving. Thus, we were assigned to prepare a project in C language in
order to have basic practical knowledge about C Programming as a part of the
subject Computer Engineering-I first year, first part of Civil Engineering Course.
Addressing the current requirement of the society we planned to create ATM
BANKING SYSTEM.
To build the project, it took us nearly two weeks. We firstly discussed about the
programme features, necessary logic and user interface. Then we modulated our
programme into number of segments. We then divided our work load among the
four of us and started working on our part. We consulted various books, Research
Article, YouTube tutorials and guidance from our teacher and seniors. After the
program was successfully written we compiled it and tested multiple times for
syntax and logical errors. Then we prepared the remaining parts of the
project such as algorithm, flowchart etc.
2. OBJECTIVES
I. To learn about different library functions included in different header files.
II. To learn about the use of user defined functions.
III. To learn to be able to develop complex programmes aimed at solving
particular task in practical field as per user requirements.
IV. To be able to work in a group as a team sharing different responsibilities.
3. FEATURES
We have given our programme essential features to make it work somehow like
prototype ATM Machine.
I. The data file is stored in binary in .dat extension, so the contents of the
file are not easily readable enhancing security of the programme.
II. We have allowed user to deposit money in the multiple of 500 in this
programme.
III. Common features of ATM; Balance Inquiry and Cash Withdrawal are
allowed.
4. LIMITATIONS
I. The developed programme will not run in a 16-bit OS.
II. This programme does not ask user to enter their unique pin.
III. Some predefined functions used in the programme were not discussed in
class.
Chapter 2:
Problem Analysis
1. Understanding Problem: We, all the project members, held a discussion
session for brief discussion of this project. We discussed about how the project
can be made effective and what are the possible stuffs that should be well-
covered in this program. We mainly discussed about following queries in our
discussion session:
i. How to start the program?
ii. What operations can be performed by the program?
iii. What are the file operations to be performed?
iv. How can we manage our food items effectively within the program?
2. Input Requirement: In this program, the users have to choose food
items from list, which can be performed by keyboard. Similarly, the
details of user also have to be entered by keyboard. So, for this purpose we
use different in-built functions for reading the input from user. In addition
to this, we used data files to store the data for future use.
3. Output Requirement: After taking the details from the user, the
program should be able to show total cost of items of the user. Also, it
should be able to show all the previous orders as a record.
4. Processing Requirement: In this program, some simple arithmetic
operations and file input/output are done as processing. The coding is done
on 32-bit OS using code-blocks GCC as a complier.
5. Technical feasibility: In the context of feasibility, the coding didn’t
require that much hard work and manpower due to simplicity of the
program. Person having general ideas about Cprogramming and file
input/output operations can perform the required coding. Though the
program was short, it was user interactive and it yielded the required
output.
Chapter 3:
REVIEW OF RELATED LITERATURE
What is C?
C is a programming language developed at AT & T’s Bell Laboratories of
USA in 1972. It was designed and written by a man named Dennis Ritchie. In
the late seventies C began to replace the more familiar languages of that time
like PL/I, ALGOL, etc. No one pushed C. It wasn’t made the ‘official’ Bell
Labs language. Thus, without any advertisement, C’s reputation spread and
its pool of users grew. Ritchie seems to have been rather surprised that so
many programmers preferred C to older languages like FORTRAN or PL/I,
or the newer ones like Pascal an APL. But that’s what happened. Possibly
why C seems so popular is because it is reliable, simple and easy to use.
1. Data Input and Output:
Generally, a computer program takes input from keyboard
(standard input device) or any other devices (e.g. data files). The
program then processes the input and sends the result to output
devices (i.e. computer screen or monitor or data file).
Formatted I/O:
Syntax for formatted I/O are:
scanf (“control string”, &arg1, &arg2, . . . . , &argn);
printf (“control string”, arg1, arg2, . . . . , argn);
Unformatted I/O:
Syntax for unformatted I/O are:
character_variable = getchar();
putchar (character_variable);
character_variable = getch();
character_variable = getche();
putch (character_variable);
gets (string_variable);
puts (string_variable);
2. Control Statements: The statements which alter flow of
execution of a program are known as control statements. In the
absence of control statements, the instructions or statements are
executed in same order in which they appear in source program.
Such type ofconstruct is known as sequential construct. There are
mainly two types of control statements: Decision Making & Loop
statements.
2.1 Decision Making Statements: The decision-making
statements test a condition and allow to execute some statements
on the basis of result of the test (i.e. either true or false). Since
they have capability to decide whether specified statements have
to be executed or not, they are called decision making statements.
i. if Statement:
An if statement is used to control the flow of execution of
statements.
Syntax:
if (test_expression)
{
statement-block;
}
ii. Nested if Statement:
When one if statement is written within body of another if
statement, it is called Nested if Statement.
Syntax:
if (expression)
{
if (expression) {
body;
}
}
iii. if..else Statement:
The if..else statement is an extension of the simple if
statement. It is used when there are two possible options.
Syntax:
if (test_expression)
{
true-block statements;
}
else (test_expression)
{
false-block statements;
}
iv. if...else if Statement:
An if..else if statement is used when there are more than two
possible action depending upon the outcome of test
expression.
Syntax:
if (condition1)
{
Statement-1;
}
else if (condition2)
{
Statement-2;
}
else if (condition)
{
Statement-n;
}
else
{
default-statement;
}
2.2 Loop construct:
Loop may be defined as the block of statements which are
repeatedly executed for a certain number of times or until a
particular condition is satisfied.
i. for Loop:
The for loop allows to execute block of statements for a
number of times.
Syntax:
for (counter_initialization; test_condition; increment or
decrement)
{
statements or body of loop;
}
ii. while Loop:
In this loop, the test condition is evaluated first and if the
condition is true, the body of loop is executed.
Syntax:
while(test_condition)
{
body of loop;
}
iii. do-while Loop:
do-while loop executes a body (i.e. block of statements) first
without checking any condition and then checks a
test_condition is checked to determine whether the body of
loop is to be executed for the next time or not.
Syntax:
do
{
statements or body of loop;
}
while(test_condition);
break statement:
The break statement terminates the execution of the loop and
the control is transferred to the statement immediately
following the loop.
Syntax:
break;
switch Statement:
When there are a number of options available and one of
them is to be selected on the basis of some criteria, switch
statement is used.
Syntax:
switch (variable or expression)
{
case caseConstant1:
statements;
break;
case caseConstant2:
statements;
break;
.
.
default:
statements;
}
3. Function:
A function is defined as self-contained block of statements that
performs a particular specified job in a program. Actually, this is
a logical unit composed of a number of statements grouped into a
single unit. C functions can be classified into two categories:
user-defined and library functions.
3.1 Library Functions (Built-in Functions):
These are the functions which are already written, compiled and
placed in C library and they are not required to be written by
programmer again. For example: printf(), scanf(), sqrt(), getch(),
etc.
3.2 User-defined Functions:
These are the functions which are defined by user at the time of
writing a program. The user has choice to choose its name, return
type and argument and their types.
4. Array and Strings:
An array is a group of related data items that share a common name. In
other words, an array is a data structure that store a number of data
items as a single entity (object). The individual data items are called
elements and all of them have same data types. For e.g. int a[20]; is an
integer array having maximum capacity to hold 20 array elements.
String is an array of character (i.e. characters are arranged one after
another in memory). In other words, a character-array is also known as
a string. For e.g. char ch[2][3]; is an string array.
5. Pointer:
A pointer is a special type of a variable. It is special because it contains
a memory address instead of values (i.e. data).
6. Data Files:
A data file is a place on the disk where a group of related data is
stored. The data file allows us to store information permanently and to
access and alter that information whenever necessary. Programming
language C has various library functions for creating and processing
data files.
Opening and Closing a file
A program must open a file before to perform reading and writing
operation on the file. Opening a file establishes a link between the
program and the operating system.
The buffer area is established as:
FILE *ptr_variable;
A data file is opened using syntax:
ptr_variable=fopen (file_name, file-mode);
The file is closed using other library function fclose() as below:
fclose (ptr_variable);
File opening modes
The file opening mode specifies the way in which a file should be
opened (i.e. for reading, writing or both, appending at the end of file,
overwriting the file, etc).
w (write):
Open the file for writing purpose only.
r (read):
Open the file for reading purpose only.
a(append):
Open the file for appending or adding contents to it.
w+ (Write + Read):
Same as w except used for both reading and writing.
r+ (Read + Write):
The existing file is opened to beginning for both reading and writing.
a+ (append + read):
Same as a except both for reading and writing.
For example:
FILE *fp;
fp=fopen(“student.txt”,”w”);
/*The above statement opens file student.txt for writing purpose */
fp = fopen(“student.txt”, “r”);
/*The above statement opens file student.txt for reading purpose. */
fp = fopen(“student.txt”, “a”);
/*The above statement opens file student.txt for appending purpose. */
Chapter 4:
ALGORITHM DEVELOPMENT AND FLOWCHART
Algorithm Development:
To write a logical step-by-step method to solve the problem is called
algorithm, in other words, an algorithm is a procedure for solving problems.
In order to solve a mathematical or computer problem, this is the first step
of the procedure. An algorithm includes calculations, reasoning and data
processing. Algorithms can be presented by natural languages, pseudo code
and flowcharts, etc.
Flowchart :
A flowchart is the graphical or pictorial representation of an algorithm with
the help of different symbols, shapes and arrows in order to demonstrate a
process or a program. With algorithms, we can easily understand a program.
The main purpose of a flowchart is to analyze different processes.
Several standard graphics are applied in a flowchart:
Algorithm development :
Algorithm for main():
step 1: start main()
step 2: delare option
step 3: declare choice
step 4: declare balance and assign 50000.00 as its value
step 5: declare Boolean data type 'again' and store 'true' and run
while loop with loop variable 'again'
step 6: read value of option from user and start switch case
step 7 : declare case 1: and call check balance function
step 8: declare case 2: and call money deposit function and store it
in balance
step 9: declare case 3: and call money withdraw function and store
it in balance
step 10: declare case 4: and call menuexit function
step 11: set "error message" in default case
Algorithm for mainmenu()
Step 1: show the message:
enter 1 for checking balance
enter 2 for depositing balance
enter 3 for withdrawing money
enter 4 to exit
Algorithm for check balance()
step 1: display" you choose to see your balance"
step 2: display the amount stored in balance
Algorithm for moneydeposit()
step 1: declare deposit in datatype float
step 2: display" you choose to deposit a balance"
step 3: display balance
step 4: enter amount to deposite and store in deposit
step 5: add value of new deposit to balance
step 6: display new balance and return balance.
Algorithm for moneywithdraw()
step 1: declare withdraw
step 2: declare Boolean variable back and assign true in it
step 3: display "you choose to withdraw money"
step 4: display previous balance
step 5: start while loop with looping variable 'back'
step 6: enter the amount to withdraw and store its value in
withdraw
step 6: If withdraw is less than or equal to balance and if withdraw
is some multiple of 500, assign variable 'back' as false and
substract withdrawn amount from balance and store it to
balance
step 7: if withdraw is not multiple of 500, display "enter the amoun
t that is multiple of 500" and assign variable 'back' as false
step 8: If the given 'if condition' is not satisfied display "you don't
have enough money, please contact our bank costumer
services" and return balance.
Algorithm for menuexit():
step 1: display "take your receipt"
step 2: display "thank you for using ATM Banking Machine"
Algorithm for error message():
step 1: display "you selected invalid number"
FLOWCHART DEVELOPMENT:
fig: Flowchart for money deposit ()
Flow chart for menu exit():
Flowchart for check balance ():
Flowchart for main menu ()
Flowchart for error message ():
Flowchart for main ()
FLOWCHART FOR MONEY WITHDRAW()
Chapter: 5
Implementation and Coding
5.1 implications
But the implementation of the plan and the idea of how the final program
somehow looks like can be obtained from the below snapshots of the program.
Fig 5.1 : main menu
Fig 5.1 is the main page of the program.You can choose respective option for
respective work.
fig 5.2 :deposit section
Fig 5.2shows the deposit section where you can see the available balance.
Fig
5.2:deposit section
fig 5.2 gives the idea about deposit section.You can enter the amount to be
deposited.
Fig 5.3:withdrawing section
You can go to withdrawing section choosing option 3 in the main menu.It asks
for the amount of money to withdraw.
5.2 CODING
In this project, C programming is used for coding. Since, C is a procedure-based
programming language, the procedures involved in meeting the objective of this
program are there in the source code. The flow of the program and the functions
involved go like this:
The list of functions used in this code are:
1. void mainMenu()
2.void checkBalance(float balance)
3.float moneyDeposit(float balance)
4.float moneyWithdraw(float balance)
5.void menuExit()
6.void errorMessage()
The above functions work in following ways:
int main(): This is the main function of the program, which is compulsory for
every C programming code. In this function, mainmenu() function is called.
void checkBalance(float balance):this function is used to check balance
available.
float moneyDeposit(float balance):this function is used to deposit
balance in the account.
float moneyWithdraw(float balance):this function is used to withdraw
money.
void menuExit():after the transection is over,this function is used to exit
the menu.
void errorMessage():this function is used to check error if any.
SOURCE CODE
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
//Functions
void mainMenu();
void checkBalance(float balance);
float moneyDeposit(float balance);
float moneyWithdraw(float balance);
void menuExit();
void errorMessage();
//Main Code
int main() {
int option;
float balance = 50000.00;
int choose;
bool again = true;
while (again) {
mainMenu();
printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
printf("Your Selection:\t");
scanf("%d", &option);
switch (option) {
case 1:
system("CLS");
checkBalance(balance);
break;
case 2:
system("CLS");
balance = moneyDeposit(balance);
break;
case 3:
system("CLS");
balance = moneyWithdraw(balance);
break;
case 4:
system("CLS");
menuExit();
return 0;
default:
errorMessage();
break;
}
printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
printf("Would you like to do another transaction:\n");
printf("< 1 > Yes\n");
printf("< 2 > No\n");
scanf("%d", &choose);
system("CLS");
if (choose == 2) {
again = false;
menuExit();
return 0;
}//main code
//Functions
void mainMenu() {
printf("******************Hello!*******************\n");
printf("**********Welcome to ATM Banking***********\n\n");
printf("****Please choose one of the options below****\n\n");
printf("< 1 > Check Balance\n");
printf("< 2 > Deposit\n");
printf("< 3 > Withdraw\n");
printf("< 4 > Exit\n\n");
}//Main Menu
void checkBalance(float balance) {
printf("You Choose to See your Balance\n");
printf("\n\n****Your Available Balance is: NPR%.2f\n\n", balance);
}//Check Balance
float moneyDeposit(float balance) {
float deposit;
printf("You choose to Deposit a money\n");
printf("$$$$Your Balance is: NPR%.2f\n\n", balance);
printf("****Enter your amount to Deposit\n");
scanf("%f", &deposit);
balance += deposit;
printf("\n****Your New Balance is: NPR%.2f\n\n", balance);
return balance;
}//money deposit
float moneyWithdraw(float balance) {
int withdraw;
bool back = true;
printf("You choose to Withdraw a money\n");
printf("$$$$Your Balance is: NPR%.2f\n\n", balance);
while (back) {
printf("Enter your amount to withdraw:\n");
scanf("%d", &withdraw);
if (withdraw <= balance&&withdraw %500==0) {
back = false;
balance -= withdraw;
printf("\n$$$$Your withdrawing money is: NPR%.2d\n", withdraw);
printf("****Your New Balance is: NPR%.2f\n\n", balance);
return(balance);
}
else if(withdraw %500!=0){
printf("please enter the amount that is multiple of 500\n");
back=false;
}
else {
printf("+++You don't have enough money+++\n");
printf("Please contact to your Bank Customer Services\n");
printf("****Your Balance is: NPR%.2f\n\n", balance);
}
}
return balance;
}//money withdraw
void menuExit() {
printf("--------------Take your receipt!!!------------------\n");
printf("-----Thank you for using ATM Banking Machine!!!-----\n");
printf("-----BROUGHT TO YOU BY code-projects.org-----\n");
}//exit menu
void errorMessage() {;
printf("+++!!!You selected invalid number!!!+++\n");
}//error message
6. RESULTS AND DISCUSSIONS
following screenshots gives the idea about the result.
Fig 6.1: balance check
In fig 6.1,it displays the amount in you account.If you want to do other
transection line withdrawing and depositing,you can directly choose the option
‘yes’ from this section without going back to the main menu.
If you want to deposit/withdraw money,you can directly go to deposit section
choosing option 2 and 3
fig 6.2: deposit section
In deposit section you can see the amount deposited and the total amount after
the
deposit.
Fig:6.3:withdrawing section
fig 6.3you can see the withdrawing section.you can withdraw the money and
get the new information of the available balance in your account.
Fig:exit section
After your transections are finished,you can exit the program you can choose no
and get you receipt.
CONCLUSIONS
After testing and running this project, following conclusions can be made:
1.This ATM banking machine system really easy to use for all age group
2.It also saves the time
3. this machine boost your productivity by eliminating the inefficient process of
transections.
4. This code shows how simple programs can be built in C programming
language
without using graphics.