0% found this document useful (0 votes)
40 views8 pages

Final Project ITP

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 8

PROJECT IN C ON BANK

MANAGEMENT SYSTEM
Here is a comprehensive and error-free project I produced as a short
project in C bank management system during my first semester. This
project is titled "Customer Account Bank Management System" because
it focuses on bank customer account services.

Here, you can create account, make deposits if account is created, make
withdrawl, search customer, update information in bank account and
report if any dissatisfaction during transactions.
Overall, this project allows you to perform banking activities in a real
bank. The C project for bank management is a console program with no
visuals. The gcc compiler is used to compile it in visual studio code.

Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Account{
char accountNumber[100];
char name[200];
char address[200];
char phone[20];
char email[200];
char dateOfBirth[10];
double balance;
int status;
char accountType[10];
int noOfDeposits;
int noOfWithDrawl;
double totalAmountofDeposit;
double totalAmountOfWithdrawl;
};

void DisplayMenu();
int CreateAccount();
void UpdateAccount();
int MakeDeposit();
int MakeWithDrawl();
void DisplayAllRecord();
FILE *OpenFile();

This study source was downloaded by 100000814149418 from CourseHero.com on 12-16-2022 08:12:52 GMT -06:00

https://www.coursehero.com/file/162674786/Final-Project-ITPdocx/
struct Account SearchAccount();

int main()
{

DisplayMenu();
return 0;
}

void DisplayMenu() {

int menuOption;
char menuInput;
menu:
system("cls");
fflush(stdin);
printf("\n************** Customer Account Bank Management System
***************");
printf("\n************** Welcome to Main Menu
***************");
printf("\n\t1.Create Account");
printf("\n\t2.Make Deposit");
printf("\n\t3.Make Withdrawl");
printf("\n\t4.Search Customer");
printf("\n\t5.Update Account");
printf("\n\t6.Report");
printf("\n\t7.exit");
printf("\nEnter your option (1-7) : ");
scanf("%d", &menuOption);

switch(menuOption){
case 1:
CreateAccount();
break;
case 2:
printf("Make Deposit");
break;
case 5:
UpdateAccount();
break;
case 6:
DisplayAllRecord();
break;
case 7:
printf("Exit");
exit(0);
break;

This study source was downloaded by 100000814149418 from CourseHero.com on 12-16-2022 08:12:52 GMT -06:00

https://www.coursehero.com/file/162674786/Final-Project-ITPdocx/
default:
printf("\n\tInvalid option... Do you want to continue? (y
for continue )?");
scanf(" %c", &menuInput);
if(menuInput == 'y')
{
system("cls");
goto menu;
}
else{
exit(0);
}
break;
}
}

FILE *OpenFile(){
FILE *fp;
fp = fopen("accountdata.bin", "a+b");

if( fp == NULL){
printf("Error Accessing File.\n");
printf("Exit from application \n");
exit(0);
}
return fp;
}

FILE *OpenFileForUpdate(){
FILE *fp;
fp = fopen("accountdata.bin", "r+b");

if( fp == NULL){
printf("Error Accessing File.\n");
printf("Exit from application \n");
exit(0);
}
return fp;
}

int CreateAccount(){

FILE *fp = OpenFile();

struct Account account;


char anotherAccount = 'y';

This study source was downloaded by 100000814149418 from CourseHero.com on 12-16-2022 08:12:52 GMT -06:00

https://www.coursehero.com/file/162674786/Final-Project-ITPdocx/
while(anotherAccount == 'y')
{
system("cls");
fflush(stdin);
printf("\n***Enter Customer Information to Create an
Account***\n");

printf("Account Number \t :");


gets(account.accountNumber);

printf("Full Name \t : ");


gets(account.name);
printf("Address \t : ");
gets(account.address);
printf("Phone \t\t : ");
gets(account.phone);
printf("Email \t\t : ");
gets(account.email);
printf("Date of birth \t : ");
gets(account.dateOfBirth);
printf("Balance \t : ");
scanf("%lf", account.balance);
account.status = 1;
fflush(stdin);
printf("Account Type (Saving\\Checking): ");
gets(account.accountType);
account.noOfDeposits = 0;
account.noOfWithDrawl = 0;
account.totalAmountofDeposit = 0;
account.totalAmountOfWithdrawl = 0;

fwrite(&account, sizeof(account), 1, fp);


printf("\n***Account Created***\n");
fflush(stdin);
printf("Do you want to add another cusomer(y for continue) ?
");
anotherAccount = getchar();
}
fclose(fp);
}

void DisplayAllRecord(){
system("cls");
FILE *fp = OpenFile();
struct Account account;
char mainMenu;
fread(&account, sizeof(account), 1, fp);

This study source was downloaded by 100000814149418 from CourseHero.com on 12-16-2022 08:12:52 GMT -06:00

https://www.coursehero.com/file/162674786/Final-Project-ITPdocx/
int counter = 1;

while(!feof(fp)){
printf("\n*** Customer %d", counter);
printf("\n*************************************");
printf("\nAccount Num\t: %s", account.accountNumber);
printf("\nName \t\t: %s", account.name);
printf("\nAddress \t: %s", account.address);
printf("\n");
fread(&account, sizeof(account), 1, fp);
counter++;

}
fflush(stdin);
printf("\nPress any key to display main menu...");
mainMenu = getchar();
DisplayMenu();
}

struct Account SearchAccount(){


system("cls");
FILE *fp = OpenFile();
struct Account account;
char mainMenu;
char accountNum[100];

printf("Enter account number to search : ");


scanf("%s", &accountNum);

fread(&account, sizeof(account), 1, fp);

while(!feof(fp)){
if(strcmp(account.accountNumber, accountNum)){
fclose(fp);
return account;
}
}
strcpy(account.accountNumber, "na");
return account;
}

void UpdateAccount(){
system("cls");
FILE *fp = OpenFileForUpdate();
struct Account account;
char mainMenu;
char accountNum[100];
int accountFound = 0;

This study source was downloaded by 100000814149418 from CourseHero.com on 12-16-2022 08:12:52 GMT -06:00

https://www.coursehero.com/file/162674786/Final-Project-ITPdocx/
int recordNo = 0;
fflush(stdin);

printf("Enter account number to update : ");


scanf("%s", &accountNum);

fread(&account, sizeof(account), 1, fp);

while(!feof(fp)){
if(strcmp(account.accountNumber, accountNum)==0){
accountFound = 1;
printf("\n***Enter new data to update***");
fflush(stdin);
printf("\nFull Name \t : ");
gets(account.name);
printf("Address \t : ");
gets(account.address);
printf("Phone \t\t : ");
gets(account.phone);
printf("Email \t\t : ");
gets(account.email);
printf("Date of birth \t : ");
gets(account.dateOfBirth);
fseek(fp, recordNo * sizeof(account), SEEK_SET);
if(fwrite(&account, sizeof(account), 1, fp) == 1){
printf("\n**Account Updated**");
}

break;
}
fread(&account, sizeof(account), 1, fp);
recordNo++;
}

if(accountFound == 0){
printf("\n**Account not found**");
}
printf("\nPress any key to display main menu...");

Functions used in Bank Management


System:
Customer Account Bank Management System's source code is short and
simple to understand. This C project is separated into several functions,

This study source was downloaded by 100000814149418 from CourseHero.com on 12-16-2022 08:12:52 GMT -06:00

https://www.coursehero.com/file/162674786/Final-Project-ITPdocx/
the most of them are connected to various financial activities. Some of
the more critical functions are listed here to help you understand the
project better.

1. DisplayMenu()
This function displays the menu or welcome screen to
perform different banking activities mentioned below.

2. CreateAccount()
This function creates a new customer account. It asks for
some personal and banking details of the customer such as name,
date of birth, citizenship number, address and phone number. You
can enter the amount to deposit and choose one type of deposit
account – saving, current, fixed for 1 year, fixed for 2 years or fixed
for 3 years.

3. UpdateAccount()
This function is to update information to the existing bank account.

4. MakeDeposit()
This function is used to deposit amount of money to the existing
particular bank account.

5. MakeWithdrawl()
This function is used to withdraw money from a particular bank
account.

6. DisplayAllRecord()
This function is used to display all recorded and updated
information of customer bank account like account number, name,
address, etc.

7. FILE *OpenFile()
This function is used to open binary file on append mode and return
to the file pointer.

Outputs:

This study source was downloaded by 100000814149418 from CourseHero.com on 12-16-2022 08:12:52 GMT -06:00

https://www.coursehero.com/file/162674786/Final-Project-ITPdocx/
Conclusion:
This is how we can create a bank management system in C programming
language. C is a powerful and general purpose programming language. It
can used to develop software like operating systems, databases,
compilers and so on. C programming is an excellent language to learn
to program for beginners. It is easy to understand and manipulate.

This study source was downloaded by 100000814149418 from CourseHero.com on 12-16-2022 08:12:52 GMT -06:00

https://www.coursehero.com/file/162674786/Final-Project-ITPdocx/
Powered by TCPDF (www.tcpdf.org)

You might also like