Bank Management System
Bank Management System
Project Title
BANK MANAGEMENT SYSTEM
Team Members
________________
________________
________________
________________
The bank management system is a C program designed to facilitate the management of bank operations.
The program allows users to create and manage bank accounts, deposit and withdraw amounts from the
balance in a bank account, create, update and delete records. The system employs various data structures
such as arrays, pointers, structures etc. to manage information on banking transactions. Files are used to
store the various records of customer bank accounts.
The program offers functionalities such as balance enquiry (checking bank balance), updating, creating,
deleting, searching records, depositing, withdrawing balance from accounts. The bank management system
is designed to improve the efficiency and accuracy of bank operations, enhance customer experience, and
develop a user friendly interface.
Objective
The aim of the project is to create a bank management system using C programming language. Using this
management system, a user would be able to perform various operations on the data stored in the system.
Features
The various features of the project are described below:
View Records: The user will be able to view all the information regarding an account, like account holder,
address, date of birth, aadhar card number, pan card number, amount of money in the account for all the
registered accounts in the bank at once.
Create Records: In this feature, the user will be able to create a new bank account according to the
information that will be inputted by them such as name of the account holder(s), address, date of birth,
aadhar card number, pan card number and minimum deposit amount.
Read Record: The user will be able to read a particular record based on their bank account information such
as account holder(s) name, bank branch, balance or any other field, valid to their own account.
Update Records: The user will be able to edit the record of their own bank account under a certain field that
is editable such as name of the account holder(s), address, date of birth, phone number and email address.
Delete Records: The user will be able to close down their bank account which will also delete all the details
of the user that were stored in the account. Search Records: The features also allows the user to easily
access or find a particular record. This can be achieved by simply inputting a name or account number.
Balance enquiry: It also has a balance enquiry feature through which, after appropriate authentication, the
user can check the balance in their bank account.
Cash deposit: This feature allows the user to make a deposit in their bank account. The balance in the
account is updated accordingly.
Cash withdrawal: This feature enables users to withdraw funds from their bank accounts. The balance in
the account is updated accordingly.
1. Header Files:
2. Global Variables:
3. Structures:
anonymous structure: A structure without a name, used to define the main structure containing account
details (`add`, `upd`, `check`, `rem`, `transaction`).
4. Functions:
menu: Main menu function to display options and call corresponding functions.
5. Main Function:
After successful login, it displays the main menu and allows the user to choose from various banking
operations.
6. Password Protection:
The program uses a simple password protection mechanism where the user needs to enter a password to
access the banking system.
7. File Handling:
The program uses file handling (`record.dat`) to store customer account information persistently.
8. Error Handling:
The program includes basic error handling, such as checking for duplicate account numbers during the
account creation process.
The program includes a feature for bill payment, where the user can choose different types of bills
(electricity, gas, education, broadband, cable TV) and make payments.
The main menu is implemented using a switch-case statement, allowing the user to choose various banking
operations interactively
int i, j;
int main_exit;
// Function prototype
void menu();
if (fp == NULL) {
printf("ERROR IN FILE CREATION\n");
return 0;
}
}
account_no:
system("cls");
printf("\t\t\tADD RECORD");
printf("\n\n\nEnter today's date(dd/mm/yyyy):");
scanf("%d/%d/%d", &add.deposit.day, &add.deposit.month, &add.deposit.year);
printf("\nEnter the account number:");
scanf("%d", &check.acc_no);
add_invalid:
printf("\n\n\n\t\tEnter 1 to go to the main menu and 0 to exit:");
scanf("%d", &main_exit);
system("cls");
if (main_exit == 1)
menu();
else if (main_exit == 0)
close();
else
{
printf("\nInvalid!\a");
goto add_invalid;
}
}
system("cls");
printf("\nACC. NO.\tNAME\t\t\tADDRESS\t\t\tPHONE\n");
view_list_invalid:
printf("\n\nEnter 1 to go to the main menu and 0 to exit:");
scanf("%d", &main_exit);
system("cls");
if (main_exit == 1)
menu();
else if (main_exit == 0)
close();
else
{
printf("\nInvalid!\a");
goto view_list_invalid;
}
}
void edit(void)
{
int choice, test = 0, ret, ret1;
FILE *old, *newrec;
if (choice == 1)
{
// Update address and write to the new file
printf("Enter the new address:");
scanf("%s", upd.address);
fprintf(newrec, "%d %s %d/%d/%d %d %s %s %lf %s %f %d/%d/%d\n", add.acc_no, add.name,
add.dob.day, add.dob.month, add.dob.year, add.age, upd.address, add.citizenship, add.phone,
add.acc_type, add.amt, add.deposit.month, add.deposit.day, add.deposit.year);
system("cls");
printf("Changes saved!");
}
else if (choice == 2)
{
// Update phone number and write to the new file
printf("Enter the new phone number:");
scanf("%lf", &upd.phone);
fprintf(newrec, "%d %s %d/%d/%d %d %s %s %lf %s %f %d/%d/%d\n", add.acc_no, add.name,
add.dob.day, add.dob.month, add.dob.year, add.age, add.address, add.citizenship, upd.phone,
add.acc_type, add.amt, add.deposit.month, add.deposit.day, add.deposit.year);
system("cls");
printf("Changes saved");
}
}
else
{
// Copy the existing record to the new file as it is
fprintf(newrec, "%d %s %d/%d/%d %d %s %s %lf %s %f %d/%d/%d\n", add.acc_no, add.name,
add.dob.day, add.dob.month, add.dob.year, add.age, add.address, add.citizenship, add.phone,
add.acc_type, add.amt, add.deposit.month, add.deposit.day, add.deposit.year);
}
}
if (test != 1)
{
// Display a message if the record is not found
printf("\nRecord not found!\n");
edit_invalid:
printf("\nEnter 0 to try again, 1 to return to main menu and 2 to exit:");
scanf("%d", &main_exit);
system("cls");
void transact(void)
{
int choice, test = 0, transferacct;
FILE *old, *newrec;
if (choice == 1)
{
// Deposit money into the account
printf("Enter the amount you want to deposit: Rs. ");
scanf("%f", &transaction.amt);
add.amt += transaction.amt;
fprintf(newrec, "%d %s %d/%d/%d %d %s %s %lf %s %f %d/%d/%d\n", add.acc_no,
add.name, add.dob.day, add.dob.month, add.dob.year, add.age, add.address, add.citizenship, add.phone,
add.acc_type, add.amt, add.deposit.month, add.deposit.day, add.deposit.year);
printf("\n\nDeposited successfully!");
}
else if (choice == 2)
{
// Withdraw money from the account
printf("Enter the amount you want to withdraw: Rs. ");
scanf("%f", &transaction.amt);
if (transaction.amt > add.amt)
{
printf("\nInsufficient balance!");
fclose(old);
fclose(newrec);
remove("new.dat");
fordelay(1000000000);
system("cls");
menu();
}
else
{
add.amt -= transaction.amt;
fprintf(newrec, "%d %s %d/%d/%d %d %s %s %lf %s %f %d/%d/%d\n", add.acc_no,
add.name, add.dob.day, add.dob.month, add.dob.year, add.age, add.address, add.citizenship, add.phone,
add.acc_type, add.amt, add.deposit.month, add.deposit.day, add.deposit.year);
printf("\n\nWithdrawn successfully!");
}
}
else if (choice == 3)
{
// Transfer money to another account
printf("Enter the amount you want to transfer:");
scanf("%f", &transaction.amt);
printf("Enter the account no. to transfer money to:");
scanf("%d", &transferacct);
if (transaction.amt > add.amt)
{
printf("\nInsufficient balance!");
fclose(old);
fclose(newrec);
remove("new.dat");
fordelay(1000000000);
system("cls");
menu();
}
else
{
add.amt -= transaction.amt;
fprintf(newrec, "%d %s %d/%d/%d %d %s %s %lf %s %f %d/%d/%d\n", add.acc_no,
add.name, add.dob.day, add.dob.month, add.dob.year, add.age, add.address, add.citizenship, add.phone,
add.acc_type, add.amt, add.deposit.month, add.deposit.day, add.deposit.year);
printf("\n\nTransferred successfully!");
}
}
}
}
else if (choice == 4)
{
// Define a structure to store payment details
struct PaymentDetails
{
char agencyName[150];
union
{
int consumerNumber;
int businessPartnerNumber;
struct
{
char state[20];
char city[20];
char instituteName[150];
} education;
struct
{
int accountId;
} broadband;
} details;
float amount;
};
// Function to validate the length of consumer number, business partner number, and
account ID
int ValidateLength(int number)
{
// Assuming a 10-digit limit for integers
return (number >= 1000000000) && (number <= 9999999999);
}
int continuePayments = 1;
int choice;
scanf("%d", &choice);
switch (choice)
{
case 1:
{
// Display the list of electricity agencies
printf("Choose the electricity agency:\n");
printf("1. Uttar Pradesh Power Corporation Ltd\n");
printf("2. Paschimanchal Vidyut Vitran Nigam Ltd\n");
printf("3. Maharashtra State Electricity Distribution Co. Ltd\n");
printf("4. Tamil Nadu Generation and Distribution Corporation Ltd\n");
printf("5. West Bengal State Electricity Distribution Company Ltd\n");
printf("6. Gujarat Urja Vikas Nigam Ltd\n");
printf("7. Karnataka Power Transmission Corporation Ltd\n");
printf("8. Kerala State Electricity Board Ltd\n");
printf("9. Rajasthan Rajya Vidyut Utpadan Nigam Ltd\n");
printf("10. Madhya Pradesh Paschim Kshetra Vidyut Vitaran Company
Ltd\n");
printf("11. Nuclear Power Corporation of India\n");
printf("12. PowerGrid Corporation of India\n");
printf("13. NHPC Limited\n");
printf("14. NTPC Limited\n");
printf("15. Power System Operation Corporation\n");
printf("16. Neyveli Lignite Corporation\n");
printf("17. Damodar Valley Corporation\n");
printf("18. Bureau of Energy Efficiency\n");
printf("19. Other\n");
case 2:
// Display the list of gas agencies
printf("Choose the gas agency:\n");
printf("1. Indraprastha Gas Limited\n");
printf("2. Mahanagar Gas Limited\n");
printf("3. Adani Gas Limited\n");
printf("4. Gujarat Gas Limited\n");
printf("5. GAIL Gas Limited\n");
printf("6. Tripura Natural Gas Company Ltd\n");
printf("7. Assam Gas Company Ltd\n");
printf("8. Green Gas Limited\n");
printf("9. Central U.P. Gas Limited\n");
printf("10. Sabarmati Gas Limited\n");
printf("11. Other\n");
case 3:
{
// Display the list of states
printf("Choose the state:\n");
printf("1. Andhra Pradesh\n2. Arunachal Pradesh\n3. Assam\n4. Bihar\n5.
Chhattisgarh\n");
printf("6. Goa\n7. Gujarat\n8. Haryana\n9. Himachal Pradesh\n10.
Jharkhand\n");
printf("11. Karnataka\n12. Kerala\n13. Madhya Pradesh\n14.
Maharashtra\n15. Manipur\n");
printf("16. Meghalaya\n17. Mizoram\n18. Nagaland\n19. Odisha\n20.
Punjab\n");
printf("21. Rajasthan\n22. Sikkim\n23. Tamil Nadu\n24. Telangana\n25.
Tripura\n");
printf("26. Uttar Pradesh\n27. Uttarakhand\n28. West Bengal\n29. Jammu
and Kashmir\n30. Ladakh\n");
printf("31. Andaman and Nicobar Islands\n32. Chandigarh\n33. Dadra
and Nagar Haveli and Daman and Diu\n");
printf("34. Lakshadweep\n35. Delhi\n36. Puducherry\n");
// Get the total number of states
int totalStates = 36; // Update this based on the total number of states
int stateChoice;
// Capital cities
char *capitalCities[] =
{
"Amaravati",
"Itanagar",
"Dispur",
"Patna",
"Raipur",
"Panaji",
"Gandhinagar",
"Chandigarh",
"Shimla",
"Ranchi",
"Bengaluru",
"Thiruvananthapuram",
"Bhopal",
"Mumbai",
"Imphal",
"Shillong",
"Aizawl",
"Kohima",
"Bhubaneswar",
"Chandigarh",
"Jaipur",
"Gangtok",
"Chennai",
"Hyderabad",
"Agartala",
"Lucknow",
"Dehradun",
"Kolkata",
"Srinagar",
"Leh",
"Port Blair",
"Chandigarh",
"Daman",
"Kavaratti",
"New Delhi",
"Puducherry"};
break;
}
case 4:
// Display the list of broadband agencies from India
printf("Choose the broadband agency:\n");
printf("1. BSNL Broadband\n2. Airtel Broadband\n3. Jio Fiber\n4. ACT
Fibernet\n5. Hathway Broadband\n");
printf("6. Tikona Broadband\n7. Excitel Broadband\n8. You Broadband\n9.
Siti Broadband\n10. RailWire Broadband\n11. Other\n");
int broadbandChoice;
scanf("%d", &broadbandChoice);
case 5:
// Display the list of cable TV agencies
printf("Choose the cable TV agency:\n");
printf("1. Tata Sky\n2. Dish TV\n3. Airtel Digital TV\n4. Sun Direct\n5.
D2H\n");
printf("6. Hathway Cable\n7. Den Networks\n8. Siti Cable\n9. Asianet
Digital\n10. GTPL\n11. Other\n");
int cableTVChoice;
scanf("%d", &cableTVChoice);
default:
printf("Invalid choice\n");
return;
}
printf("Do you want to pay another bill? (1 for Yes / 0 for No): ");
scanf("%d", &continuePayments);
if (!continuePayments)
{
printf("Ok\n");
}
else if (add.amt == 0)
{
printf("Insufficient balance.");
}
}
}
BillPayments();
fprintf(newrec,"%d %s %d/%d/%d %d %s %s %lf %s %f
%d/%d/%d\n",add.acc_no,add.name,add.dob.day,add.dob.month,add.dob.year,add.age,add.address,add.
citizenship,add.phone,add.acc_type,add.amt,add.deposit.month,add.deposit.day,add.deposit.year);
printf("\n\Bill paid successfully!");
}
else
{
fprintf(newrec,"%d %s %d/%d/%d %d %s %s %lf %s %f
%d/%d/%d\n",add.acc_no,add.name,add.dob.day,add.dob.month,add.dob.year,add.age,add.address,add.
citizenship,add.phone,add.acc_type,add.amt,add.deposit.month,add.deposit.day,add.deposit.year);
}
}
fclose(old); // Close the existing file
fclose(newrec); // Close the new file
int ret = remove("record.dat"); // Remove the existing file
int ret1 = rename("new.dat", "record.dat"); // Rename the new file to the existing file name
if(test != 1)
{
// If the record is not found
printf("\n\nRecord not found!");
transact_invalid:
printf("\n\n\nEnter 0 to try again, 1 to return to the main menu, and 2 to exit:");
scanf("%d", &main_exit);
system("cls");
if (main_exit == 0)
transact();
else if (main_exit == 1)
menu();
else if (main_exit == 2)
close();
else
{
printf("\nInvalid!");
goto transact_invalid;
}
}
else
{
// If the record is found
printf("\nEnter 1 to go to the main menu and 0 to exit:");
scanf("%d", &main_exit);
system("cls");
if (main_exit == 1)
menu();
else
close();
}
}
void erase(void)
{
FILE *old, *newrec;
int test = 0;
old = fopen("record.dat", "r"); // Open the existing file in read mode
newrec = fopen("new.dat", "w"); // Open a new file in write mode
if (test == 0)
{
printf("\nRecord not found!!\a\a\a");
erase_invalid:
printf("\nEnter 0 to try again, 1 to return to main menu, and 2 to exit:");
scanf("%d", &main_exit);
if (main_exit == 1)
menu();
else if (main_exit == 2)
close();
else if (main_exit == 0)
erase();
else
{
printf("\nInvalid!\a");
goto erase_invalid;
}
}
else
{
printf("\nEnter 1 to go to the main menu and 0 to exit:");
scanf("%d", &main_exit);
system("cls");
if (main_exit == 1)
menu();
else
close();
}
}
void see(void)
{
FILE *ptr;
int test = 0, rate;
int choice;
float time;
float intrst;
ptr = fopen("record.dat", "r");
if (choice == 1)
{
// User wants to search by account number
printf("Enter the account number:");
scanf("%d", &check.acc_no);
// Loop through the file to find the account with the given account number
while (fscanf(ptr, "%d %s %d/%d/%d %d %s %s %lf %s %f %d/%d/%d", &add.acc_no, add.name,
&add.dob.day, &add.dob.month, &add.dob.year, &add.age, add.address, add.citizenship, &add.phone,
add.acc_type, &add.amt, &add.deposit.month, &add.deposit.day, &add.deposit.year) != EOF)
{
if (add.acc_no == check.acc_no)
{
system("cls");
test = 1;
// Loop through the file to find the account with the given name
while (fscanf(ptr, "%d %s %d/%d/%d %d %s %s %lf %s %f %d/%d/%d", &add.acc_no, add.name,
&add.dob.day, &add.dob.month, &add.dob.year, &add.age, add.address, add.citizenship, &add.phone,
add.acc_type, &add.amt, &add.deposit.month, &add.deposit.day, &add.deposit.year) != EOF)
{
if (strcmpi(add.name, check.name) == 0)
{
system("cls");
test = 1;
if (test != 1)
{
// Display a message if the record is not found
printf("\nRecord not found!!\a\a\a");
see_invalid:
printf("\nEnter 0 to try again, 1 to return to the main menu and 2 to exit:");
scanf("%d", &main_exit);
system("cls");
void close(void)
{
printf("\n\n\n\nThank You!\n");
}
void menu(void)
{
int ch;
int main()
{
char pass[10], password[10] = "SIYA";
int i = 0, p = 0;
login_try:
// Prompt to try again or exit
printf("\nEnter 1 to try again and 0 to exit:");
scanf("%d", &main_exit);
if (main_exit == 1)
{
system("cls");
main(); // Retry login if user chooses 1
}
else if (main_exit == 0)
{
system("cls");
close(); // Exit the program if user chooses 0
}
else
{
printf("\nInvalid!");
fordelay(1000000000);
system("cls");
goto login_try; // Retry if user enters an invalid option
}
}
return 0;
}
Output Screens
SDF-1 Topics Used
1. File handling in ‘C’
2. Functions
3. Arrays
4. Pointers
5. Structures
6. User defined input
Software Used