Library Management
Submitted to
Undertaken at :
ACKNOWLEDGEMENT
am
sincerely
thankful
to
Mr.
Rajkumar Sharma , whose cooperation has resulted in successful completion of the project. I express my gratitude towards Mr. Kapil for his valuable and inspiring guidance in preparation of this project report. His able guidance perfect teaching, charming personality encouraged us to learn in the field of computer. I am grateful to Mr. Rajkumar Sharma for his interest and timely guidance right to me. We are thankful to my friends who helped me in collecting data for this job. At last we express our feeling to our parents who took so much co-operate for my project and others who helped me to prepare this project report.
DEEPTI
INDEX
1. Importance of the Project 2. Preface 3. 4. 5. 6. 7. 8. 9. System Requirement User Manual/Working of the Project Development Process Model Software Equations Used Project Category/Type Risk Analysis Object Oriented Development
10. Data Structure/Attributes 11. 12. Modular Structure of Project Reports Generation
Program Listing Output Validation Checks Context free Diagram ER Diagram Data Flow Diagrams Flow Chart Conclusion of the project Bibliography
CRETIFICATE
It is to certify that the work entitled ATM This is being submitted by me in partial fulfillment of the Requirement for Award of the degree M.Sc on the Directorate Of Distance Education is an authentic work carried out by me under the supervision and guidance of Sh. Rajkumar Sharma. The matter imbedded in this project has not been submitted earlier for the award of any other degree or diploma.
PREFACE
Objective of this project is to develop a user friendly software for Credit Card Company reduced the work load and computerize the working like issuing credit card, withdraw money, etc. It replaces all the manual and paper work and makes transactions very fast and easy. It keeps record of thousands of customers. User can view any customer status at any time or view list of card holders or withdraw money from the card.
SYSTEM REQUIREMENT
Hardware Requirement
1. 2. 3. 4. 5. 6. Pentium Processor or above Color Monitor Keyboard 8 GB Hard Disk or above 8 MB RAM or above 1.44 MB Floppy Disk Drive
Software Requirement
1. 2. Windows 9x or MS-DOS 6.22 Turbo C++ Compiler
In this project we have used Rapid Application Development (RAD) model. RAD is an incremental software development process model that emphasizes an extremely short development cycle. The following phases are encompassed:
Business modeling: All the information about the business functioning of the Credit Card Company is collected, how the data and information is flow from one end to another end using the following questions: What information drives the business process? What information is generated? Who generates it? Where does the information go? Who process it? Data modeling: The information collected in Business modeling phase is refined into a set of data objects that are needed to support the project. The attributes of each object are identified and the relationships between these objects defined. Process modeling: Processing descriptions and functions like adding, modifying, deleting customer records, withdraw money, printing reports, etc. are created. Application generation: The fourth generation techniques are used to generate application, like reusing the predefined functions or creating reusable components. Testing: Most of the functions are already tested as they are predefined functions. However, new components or functions are also tested after application generation.
The software equation is a dynamic multivariable model that assumes a specific distribution of effort over the life of a software development project. Minimum development time is defined as : tmin = 8.14 (LOC/P)0.43 where, tmin = minimum time in months LOC = estimate of size (Lines of Code) P = Productivity parameter tmin = 8.14 (1000/28000) 0.43 tmin = Effort: E = 180 Bt3 Where, E = Effort in person months B = special skill factor t = time in years E=
PROJECT CATEGORY
(OOPS Object Oriented Programming System) Object Oriented Programming is a method of programming that seeks to mimic the way we form models of the world. To cope with the complexities of life, we have evolved a wonderful capacity to generalize, classify and generate abstractions. Almost every noun in our vocabulary represents a class of objects sharing some set of attributes or behavioral traits.
The entire basis of Object Oriented Programming, infact is defining the Object in Object Oriented Programming. Object is a unit that combines both code and data together. And an object is an instance of a class. Class is a type of data structure defined to hold both data and the code functions.
Object Oriented Programming also allows you to design and implement your application more quickly than traditional approaches. Object Oriented Programming also makes code easier to maintain so that you can refine the implementation without causing major problems.
RISK ANALYSIS
Project Risk : It identify potential budgetary, schedule, personnel, resource, customer, and requirements problems and their impact on software. All the above factors are analyzed, customer requirements are analyzed properly.
Technical Risk : It identify potential design, implementation, interface, verification, and maintenance problems. All the above factors have been analyzed.
Business Risk : (1) Software is developed keeping in mind that there is demand in market, so that to avoid the market risk. (2) Software is designed to fit into the overall business strategy for the company, to avoid the strategic risk. (3) The software is easily understandable by the sales persons, so that they could know much about the product and sell in the market. (4) It has the strong management support, and not likely to change in the management people to avoid the management risk. (5) Software fits the budget and there is no budget risk.
DATA STRUCTURE
: : :
Code no. of the card. Name of the card. Maximum limit amount that could be withdrawn by the customer.
: : : : : :
Card number. Name of the customer. Phone no. of the customer. Address of the customer. Code no. of the card. Balance amount on the card.
MODULAR STRUCTURE
4 classes has been used in this project:
Modules in class MENU_CLASS: menu() line_hor() line_ver() report_menu() card_edit_menu() customer_edit_menu() : : : : : : Function to display main menu. Function to draw horizontal line. Function to draw vertical line. Function to display reports menu. Function to display edit menu for card. Function to display edit menu for customers.
Modules in class CARD: add() deletion() display_list() card_found() get_data() display_record() : : : : : : Function to add new card record in the card file. Function to delete existing card record from the file. Function to display list of all the cards. Function to return card found or not for the given card code. Function to return maximum limit amount of the card for the given card code. Function to display single card record.
Modules in class CUSTOMER: addcust() modify() display_list() display_customer_record() delete_record() display_record() : : : : : : Function to add new customer record in the customer file. Function to update card balance amount. Function to display list of the customers. Function to display single customer record. Function to delete record of the customer. Function to display balance of the card.
Modules in class ACCOUNT: display() : Function to display and withdraw amount from the card.
REPORT GENERATION
Card Report : User can view list of cards by selecting option 1 from the Reports menu.
Customer Report : User can view list of customers by selecting option 2 from the Reports menu.
#include<iostream.h> #include<conio.h> #include<dos.h> #include<string.h> #include<fstream.h> #include<process.h> #include<stdlib.h> #include<stdio.h> #include<ctype.h> #include <graphics.h> class menu_class { public : void menu(void) ; void line_hor(int, int, int, char) ; void line_ver(int, int, int, char) ; void report_menu(void) ; void card_edit_menu(void) ; void customer_edit_menu(void) ; };
int card_found(char *); float get_data(char *) ; private : void display_record(int) ; char cardname[15] ; char cardcode[5] ; float limit ; };
class customer { public : void addcust(void) ; void checkout(void) ; void modify(int,float) ; void transcation(void); void deletion(void) ; void display_list(void) ; void display_customer_record(void) ; void delete_record() ; private : void display_record(int) ; int cardno; char name[21] ,phone[8] ,address[50],cardcode[6]; float amt ; };
void menu_class::line_hor(int column1, int column2, int row, char c) { for ( column1; column1<=column2; column1++ ) { gotoxy(column1, row) ; cout <<c ; } } void menu_class :: line_ver(int row1, int row2, int column, char c) { for ( row1; row1<=row2 ; row1++) { gotoxy(column,row1) ; cout <<c ; } } void menu_class :: menu(void) { char ch ; char h[] = {"CREDIT"} ;
char m[] = {"CARD"} ; int j ; while (1) { clrscr() ; j=9; for (int i = 0; h[i]!= '\0' ; i++) { gotoxy (15,j) ; j++ ; cout << h[i] ; } j = 10 ; for (i=0; m[i]!='\0';i++) { gotoxy(65,j) ; j++ ; cout <<m[i] ; } gotoxy (30,7) ; cout <<"1. Customer " ; gotoxy (30,9) ; cout <<"2. Credit Card " ; gotoxy (30,11) ; cout<<"3. Report "; gotoxy(30,13); cout << "0. Exit To DOS " ; gotoxy(30,20) ; cout <<"Enter Your Choice : " ;
ch = getch () ; switch(ch) { case '1': customer_edit_menu() ; break; case '2': card_edit_menu() ; break; case '3': report_menu() ; break; case '0': exit(0); } } }
void menu_class :: card_edit_menu(void) { menu_class s; char ch; while(1) { clrscr() ; gotoxy(30,8) ; cout <<"1. Add New Card " ; gotoxy(30,10) ; cout <<"2. Delete Card Records" ; gotoxy(30,12) ;
cout <<"0. Exit" ; gotoxy(30,15) ; cout <<"Enter Your Choice" ; ch = getch() ; if ( ch == '1' ) { card r ; r.add() ; } if ( ch == '2' ) { card r ; r.deletion() ; } else if ( ch == '0' ) s.menu() ; } } void menu_class :: customer_edit_menu(void) { char ch ; while(1) { clrscr() ; gotoxy(30,8) ; label1 : cout <<"1. New Customer" ; gotoxy(30,10) ;
cout <<"2. Delete Customer" ; gotoxy(30,12) ; cout<<"3. Customer Report"; gotoxy(30,14); cout <<"0. EXIT" ; gotoxy(30,17) ; cout <<"Enter Your Choice" ; ch = getch() ; if ( ch == '1' ) { customer c ; c.addcust() ; } else if (ch =='2') { customer c; c.delete_record() ; } else if ( ch == '3') { customer c ; c.display_customer_record() ; } else if ( ch == '0' ) break ; }
} void menu_class :: report_menu(void) { char ch; while(1) { clrscr(); gotoxy(30,8); cout<<"1. List of Cards" ; gotoxy(30,10); cout<<"2. List of Customers :"; gotoxy(30,12); cout<<" 0. Exit "; gotoxy(30,15); cout<<"enter your choice "; ch=getch(); if(ch=='1') { card r; r.display_list(); } else if(ch=='2') { customer c; c.display_list(); } else
if(ch=='0') break; } } int card::card_found(char *t_cardcode) { fstream file; file.open("CARD.DAT",ios::in) ; file.seekg(0); int found=0; while (file.read((char*) this, sizeof(card))) { if (strcmpi(cardcode,t_cardcode)==0) found=1; } file.close(); return found; }
void card :: display_list(void) { clrscr(); fstream file ; file.open("card.dat",ios::in); file.seekg(0); int row=5, pageno=1; gotoxy(18,1);
cout<<"List of Card"; gotoxy(1,3); cout <<" Card Code { delay(20) ; gotoxy(2,row) ; cout<<cardcode ; gotoxy(24,row) ; cout<<cardname ; gotoxy(49,row) ; cout<<limit ; if ( row == 23 ) { row = 5 ; gotoxy(66,1) ; cout <<"Page no. : " <<pageno ; pageno++ ; gotoxy(1,25) ; cout <<"Press any key to continue...." ; getche() ; clrscr() ; gotoxy(18,1) ; cout <<"LIST OF Cards" ; gotoxy(1,3) ; cout <<"Card code } else row++ ; Card Name Limit " ; Card Name Limit " ; while (file.read((char *) this, sizeof(card)))
} gotoxy(66,1) ; cout <<"Page no. : " <<pageno ; gotoxy(1,25) ; cout <<"Press any key to continue...." ; getche() ; file.close () ; }
float card :: get_data(char *t_cardcode) { float t_limit; fstream file ; file.open("CARD.DAT", ios::in) ; file.seekg(0) ; float t_amt ; while (file.read((char *) this, sizeof(card))) { if (strcmpi(t_cardcode,cardcode)==0) { t_limit = limit ; break ; } } file.close() ; return t_limit ; }
void card :: add (void) { char ch ; int ct=0; char t_cardcode[5] ; char t_cardname[15] ; float t_limit ; do { clrscr() ; gotoxy(1,1) ; cout <<"Enter the details for the Card" ; gotoxy(1,3) ; cout <<"Code gotoxy(1,4) ; cout <<"Card Name. : " ; gotoxy(1,5) ; cout <<"Limit gotoxy(20,11) ; cout <<"GC : Gold Card" ; gotoxy(20,12) ; cout <<"EC : Executive Card" ; gotoxy(20,13) ; cout <<"CC : Classic Card" ; gotoxy(20,14) ; cout <<"SC : Silver Card" ; int valid = 0 ; do { : "; : ";
valid = 1 ; gotoxy(1,25) ; cout <<"ENTER THE Card CODE (GC/EC/CC/SC)" ; gotoxy(13,3) ; cin >>t_cardcode ; strupr(t_cardcode) ; char *string[4] = {"GC","CC","SC","EC"} ; int result , count = 0 ; for ( int i=0; i<4; i++) { result = strcmpi(t_cardcode,string[i]) ; if ( result != 0 ) count++ ; } if ( count == 4 ) { valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(1,25) ; clreol() ; gotoxy(1,24) ; cout <<"INVALID CODE" ; gotoxy(1,25) ; cout <<"Press any key to continue . . ." ; getche(); gotoxy(1,24) ; clreol() ; gotoxy(1,25) ; clreol() ; gotoxy(13,3) ; clreol() ;
} if (card_found(t_cardcode)) { menu_class m ; ct++; valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(1,25) ; clreol() ; gotoxy(1,24) ; cout <<"Card Code already exist" ; if(ct==4) valid=1; gotoxy(1,25) ; cout <<"Press any key to continue . . .\t" ; cout<<"Or press enter to exit"; ch=getch(); if( ch=='\r') { m.card_edit_menu(); } gotoxy(1,24) ; clreol() ; gotoxy(1,25) ; clreol() ; gotoxy(13,3) ; clreol() ; } }
while ( valid==0 ) ; for ( int i=11; i<=14; i++ ) { gotoxy(1,i) ; clreol() ; } do { valid = 1 ; gotoxy(1,25) ; clreol() ; gotoxy(1,25) ; cout << "Enter the Card Name" ; gotoxy(13,4) ; gets(t_cardname); if ( strlen(t_cardname) <= 0 || strlen(t_cardname) > 15 ) { valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(1,25) ; clreol() ; gotoxy(1,24) ; cout <<"IT SHOULD NOT BE ZERO OR GREATER THAN 15" ; gotoxy(1,25) ; cout <<"Press any key to continue . . . " ; getche() ; gotoxy(1,24) ; clreol() ; gotoxy(1,25) ; clreol() ; gotoxy(13,4) ; clreol() ;
} } while ( !valid ) ; do { valid = 1 ; gotoxy(1,25) ; clreol() ; gotoxy(1,25) ; cout <<"Enter the Limit for Card" ; gotoxy(13,5) ; cin >>t_limit ; if ( t_limit <= 0 ) { valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(1,25) ; clreol() ; gotoxy(1,24) ; cout <<"Press any key to continue . . ." ; getche() ; gotoxy(1,24) ; clreol() ; gotoxy(1,25) ; clreol() ; gotoxy(13,6) ; clreol() ; } } while ( ! valid ) ; gotoxy(1,8) ; cout <<"Do you want to save the record (y/n) : " ; do {
valid = 1 ; gotoxy(42,8) ; ch = getche() ; ch = toupper(ch) ; if (ch != 'Y' && ch != 'N') { valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(42,8) ; clreol() ; } } while ( ! valid ) ; if (ch == 'Y') { strcpy(cardcode,t_cardcode) ; strcpy(cardname,t_cardname) ; limit = t_limit ; fstream file ; file.open("CARD.DAT", ios::app); file.write((char *) this, sizeof(card) ) ; file.close() ; } gotoxy(1,9) ; cout <<"Do you want to add more records (y/n) : " ; do { valid = 1 ; gotoxy(42,9) ;
ch = getche() ; ch = toupper (ch) ; if (ch != 'Y' && ch != 'N') { valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(42,9) ; clreol() ; } } while ( !valid ) ; } while ( ch == 'Y' ) ; }
void card :: deletion(void) { clrscr() ; int valid ; char ch ; char t_cardcode[5] ; gotoxy(1,3) ; cout <<"Enter the Card Code. to be deleted : " ; cin >>t_cardcode ; strupr(t_cardcode) ; char *string[4] = {"GC","CC","SC","EC"} ; int result , count = 0 ;
for ( int i=0; i<4; i++) { result = strcmpi(t_cardcode,string[i]) ; if ( result != 0 ) count++ ; } if ( count == 4 ) { valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(1,25) ; clreol() ; gotoxy(1,24) ; cout <<"INVALID CODE" ; gotoxy(1,25) ; cout <<"Press any key to continue . . ." ; getche(); gotoxy(1,24) ; clreol() ; gotoxy(1,25) ; clreol() ; gotoxy(13,3) ; clreol() ; return; } gotoxy(1,10) ; cout <<"Do you want to delete this Card (y/n) : " ; do { valid = 1 ;
gotoxy(48,10) ; ch = getche() ; ch = toupper(ch) ; if (ch != 'Y' && ch != 'N') { valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(42,9) ; clreol() ;
} } while ( !valid ) ; if (ch == 'N') return ; fstream file ; file.open("CARD.DAT", ios::in) ; fstream tempfile ; tempfile.open("TCARD.DAT", ios::out) ; file.read((char *) this, sizeof(card)) ; while (file) { if ( strcmpi(cardcode,t_cardcode)!=0) tempfile.write((char *) this, sizeof(card)) ; file.read((char *) this, sizeof(card)) ; } file.close() ; tempfile.close() ;
file.open("CARD.DAT" , ios::out) ; tempfile.open("TCARD.DAT" , ios::in) ; tempfile.seekg(0) ; tempfile.read((char *) this, sizeof(card)) ; while (tempfile) { file.write((char *) this, sizeof(card)) ; tempfile.read((char *) this, sizeof(card)) ; } file.close() ; tempfile.close() ; }
void customer :: display_list(void) { clrscr() ; fstream file ; file.open("CLIENT.DAT" , ios::in) ; file.seekg(0) ; int row = 5, pageno = 1, total = 0 ; gotoxy(18,1) ; cout <<" LIST OF CUSTOMERS" ; Name Phone Amount gotoxy(1,3) ; cout <<"Card No. Card" ; while (file.read((char *) this, sizeof(customer))) { total++ ;
delay(20) ; gotoxy(2,row) ; cout<<cardno ; gotoxy(13,row) ; puts(name); fflush(stdout); gotoxy(38,row) ; cout<<phone ; gotoxy(53,row); cout<<amt; gotoxy(65,row); if(strcmpi(cardcode,"gc")==0) cout<<"Gold Card"; else if(strcmpi(cardcode,"cc")==0) cout<<"Classic Card"; else if(strcmpi(cardcode,"sc")==0) cout<<"Silver Card"; else cout<<"Executive Card"; if ( row == 23 ) { row = 5 ; gotoxy(66,1) ; cout<<"Page no. ; " <<pageno ; pageno++ ; gotoxy(1,25) ; cout <<"Press any key to continue . . ." ;
getche() ; clrscr() ; gotoxy(18,1) ; cout <<"List of Customers" ; gotoxy(1,3) ; cout <<"Card No. Amount" ; } else row++ ; } gotoxy(66,1); cout<<"Page no. : " <<pageno; gotoxy(1,25); cout<<"Press any key to continue..."; getche(); clrscr(); gotoxy(5,5); cout<<"Total no. of customers = "<<total; gotoxy(1,25); cout<<"Press any key to continue..."; getche(); file.close(); } void customer :: addcust(void) { // customer g; card r ; char ch ; Name Phone
int valid =1; int t_cardno; char t_name[21],t_address[50], t_phone[8], t_passwd[6],t_cardcode[6] ; float t_amt; clrscr() ; gotoxy(1,1) ; cout <<"Enter the details of the customer " ; gotoxy(1,3) ; cout <<"Card no. gotoxy(1,4) ; cout <<"Name gotoxy(1,5) ; cout <<"Address gotoxy(1,6) ; cout <<"Phone (7 digits): " ; gotoxy(1,9) ; cout<<"Card Code gotoxy(20,3); gotoxy(1,25); cout<< "ENTER THE VALUES IN DIGITS"; gotoxy(20,3); cin>>t_cardno ; gotoxy(1,25) ; clreol() ; gotoxy(1,25) ; cout <<"Enter the Name of the Customer" ; gotoxy(20,4) ; gets(t_name) ; strupr(t_name) ; : "; :"; :"; :";
fflush(stdin) ; gotoxy(1,25) ; clreol() ; gotoxy(1,25) ; cout <<"Enter the Address of the Customer" ; gotoxy(20,5) ; gets(t_address) ; fflush(stdin) ; do { valid = 1 ; gotoxy(1,25) ; clreol() ; gotoxy(1,25) ; cout <<"ENTER THE PHONE NO. OF THE CUSTOMER, ENTER '-' FOR NO PHONE NO." ; gotoxy(20,6) ; cin >>t_phone ; if ((strlen(t_phone) < 7 && strlen(t_phone) > 1) || (strlen(t_phone) >7 )) { valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(1,25) ; clreol() ; gotoxy(1,24) ; cout <<"PHONE NUMBER SHOULD BE A 7 DIGIT NUMBER" ;
gotoxy(1,25) ; cout <<"Press any key to continue. . . " ; getche() ; gotoxy(1,24) ; clreol() ; gotoxy(1,25) ; clreol() ; gotoxy(20,6) ; clreol() ; } } while ( !valid ) ; do { valid = 1 ; gotoxy(1,25) ; clreol(); cout <<"Enter The Card Code (GC/CC/DC/EC)" ; gotoxy(20,9) ; cin >>t_cardcode ; strupr(t_cardcode) ; char *string[4] = {"GC","CC","SC","EC"} ; int result , count = 0 ; for ( int i=0; i<4; i++) { result = strcmpi(t_cardcode,string[i]) ; if ( result != 0 ) count++ ; } if ( count == 4 ) { valid = 0 ; sound(500) ;
delay(100) ; nosound() ; gotoxy(1,25) ; clreol() ; gotoxy(1,24) ; cout <<"INVALID CODE" ; gotoxy(1,25) ; cout <<"Press any key to continue . . ." ; getche(); gotoxy(1,24) ; clreol() ; gotoxy(1,25) ; clreol() ; gotoxy(20,9);clreol(); }
} while (valid == 0 ) ; gotoxy(1,15) ; cout <<"Do you want to save the record (y/n) : " ; do { valid = 1 ; gotoxy(42,15) ; ch = getche() ; ch = toupper(ch) ; if (ch != 'Y' && ch != 'N' ) { valid = 0 ; sound(500) ; delay(100) ; nosound() ;
gotoxy(42,15) ; clreol() ; } } while ( !valid ) ; if (ch == 'Y' ) { char *t_code=t_cardcode; cardno =t_cardno ; strcpy(name,t_name) ; strcpy(address,t_address); strcpy(phone,t_phone); strcpy(cardcode,t_cardcode); amt = r.get_data(t_code) ; fstream file ; file.open("CLIENT.DAT", ios::app) ; file.write((char*) this,sizeof(customer)) ; file.close() ; } }
void customer :: display_record(int t_cardno) { menu_class m; char pass1,pass2,pass3,pass4,pass5; fstream file ; file.open("CLIENT.DAT", ios::in) ; file.seekg(0) ; int found = 0 ; while (file.read((char *) this, sizeof(customer)) && !found)
{ if(t_cardno==cardno) { clrscr(); found = 1 ; menu_class m ; m.line_hor(2,59,1,15) ; m.line_hor(2,59,24,15) ; m.line_ver(1,24,2,15) ; m.line_ver(1,24,59,15) ; gotoxy(40,5) ; cout <<"Your Card Number: "; gotoxy(40,7); cout <<cardno ; gotoxy(5,5) ; cout <<"Your Name : " ; gotoxy(5,7); cout<<name ; gotoxy(5,10) ; cout<<"Your Address : "; gotoxy(5,12); cout <<address ; gotoxy(40,10) ; cout <<"Phone Number gotoxy(40,12); cout <<phone ; gotoxy(5,15) ; cout <<" Avaiable Cash Limit (Rs.):"; : ";
gotoxy(5,17); cout <<amt ; } } file.close () ; } void customer :: modify(int t_cardno, float tamt) { fstream file ; file.open("CLIENT.DAT", ios::in) ; file.seekg(0) ; int count = 0 ; while (file.read((char *) this, sizeof(customer))) { count++ ; if (t_cardno == cardno) break ; } file.close() ; int recno ; recno = count ; int location ; file.open("CLIENT.DAT",ios::out|ios::ate); location = (recno-1) * sizeof(customer) ; file.seekp(location) ; amt = tamt ; file.write((char *) this, sizeof(customer)) ; file.close() ;
} void customer :: delete_record() { clrscr(); int t_cardno; int valid ; char ch ; gotoxy(1,3) ; cout <<"Enter the Card Number to be deleted" ; cin>>t_cardno; display_record(t_cardno); gotoxy(1,25); cout <<"Do you want to delete this Record (y/n) : " ; do { valid = 1 ; gotoxy(48,25) ; ch = getche() ; ch = toupper(ch) ; if (ch != 'Y' && ch != 'N') { valid = 0 ; sound(500) ; delay(100) ; nosound() ; gotoxy(42,9) ; clreol() ; } } while ( !valid ) ;
if (ch == 'N') return ; fstream file ; file.open("CLIENT.DAT", ios::in) ; fstream temp ; temp.open("T_CLIENT.DAT", ios::out) ; file.read((char *) this, sizeof(customer)) ; while ( !file.eof() ) { if ( cardno != t_cardno ) temp.write((char *) this, sizeof(customer)) ; file.read((char *) this, sizeof(customer)) ; } file.close() ; temp.close() ; file.open("CLIENT.DAT", ios::out) ; temp.open("T_CLIENT.DAT", ios::in) ; temp.seekg(0) ; temp.read((char *) this, sizeof(customer)) ; while ( !temp.eof() ) { file.write((char *) this, sizeof(customer)) ; temp.read((char *) this, sizeof(customer)) ; } file.close() ; temp.close() ; } void customer :: display_customer_record(void)
{ clrscr() ; card r ; int valid ; int t_cardno ; char t_name[21],t_cardcode[5]; float t_amt; gotoxy(1,3) ; cout <<"Enter the Card Number of the customer cin >>t_cardno ; clrscr() ; gotoxy(5,3) ; cout <<"CUSTOMER RECORD" ; display_record(t_cardno) ; gotoxy(1,25) ; cout <<"Press any key to continue . . ." ; getch() ; account a; fstream file; file.open("CLIENT.DAT",ios::in); while( file.read((char *) this,sizeof(customer))) { if(t_cardno==cardno) { t_amt=amt; strcpy(t_name,name); } } a.display(t_amt,t_name,t_cardno); :";
getch(); } void account::display(float t_amt,char t_name[21],int t_cardno) { clrscr(); float p_amt; cout<<t_name<<" cout<<" cin>>p_amt; t_amt=t_amt-p_amt; if (t_amt<=0) { cout <<"Transaction Declined- Insufficient Funds...."; getch(); return; } customer c ; c.modify(t_cardno,t_amt); cout<<t_name<<" } void load() { clrscr(); char ch; int r; char s[]={ " PLEASE WAIT WHILE THE PROGRAM LOADS"}; for(int j=0;j<=strlen(s);j++) { "<<t_cardno<<" "<<t_amt; "<<t_cardno<<" "<<t_amt; Withdrawal Amount:?";
gotoxy(4+j,0);cout<<s[j]; delay(50); } gotoxy(10,4);cout<<" LOADING... "; for(int i=0;i<=100;i++) { delay(50); gotoxy(15,5);cout<< i<<"% COMPLETE"; sound(3000); delay(10); nosound(); } sleep(1); sound(2500); delay(100); nosound(); clrscr(); gotoxy(5,3) ; cout<<" INITIALIZING ............ "; sleep(1); clrscr(); char n[]={ " \ PROJECT ON CREDIT CARDS \ " }; gotoxy(26,4); cout<<n; for(int k=0;k<strlen(n)-2;k++) {
gotoxy(27+k,5); cout<<"*"; delay(100); sound(3000); delay(10); nosound(); } delay(100); char m[]={ "DEVELOPED BY " }; char l[]={ "MANJEET SHOKEEN"}; gotoxy(33,11); cout<<m; for (int q=1;q<=33;q++) { gotoxy(q,14); cout<<l; delay(30); gotoxy(q,14); cout<<" "; sound(2000); delay(30); nosound(); } gotoxy(33,14);cout<<l; gotoxy(9,23); cout<< " PRESS ANY KEY TO CONTINUE OR PRESS"; cout<<" 'ENTER' TO EXIT THE PROGRAM "; ch=getch() ;
void board(void) { int gd=DETECT,gm; int maxx,maxy; initgraph(&gd,&gm,""); maxx=getmaxx(); maxy=getmaxy(); rectangle(0,0,maxx,maxy); rectangle(2,2,maxx-2,maxy-2); settextstyle(TRIPLEX_FONT,HORIZ_DIR,6); outtextxy(220,100,"CREDIT"); settextstyle(TRIPLEX_FONT,HORIZ_DIR,6); outtextxy(240,200,"CARD"); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3); outtextxy(220,300,"Developed By"); settextstyle(TRIPLEX_FONT,HORIZ_DIR,2); outtextxy(220,350,"MANJEET SHOKEEN"); settextstyle( TRIPLEX_FONT,HORIZ_DIR,2); outtextxy(182,380," (R.NO.- B/JMBS/26809)"); getche(); closegraph(); }
VALIDATION CHECKS
While dealing with updation, we stressed on the importance of ensuring that the source data was error free. This process is called validation of the input data. Validation checks while taking input data from the user: 1. Size of the field : Field size is checked while taking input in the character fields like name, address. eg. name can have only 30 characters, user cannot enter more than 30 characters in name field.
2.
Range : Range of the field like limit, amount, etc. are checked. Eg. Amount must be greater than 0.
3.
Character check : When single character has to be input, like y (yes) or n (no), it has been checked that user should input correct character.
4.
Before making any updation, it has been checked that particular record is present in the file or not.
Digit Check : It has been checked that user should not enter character instead of digits in numeric fields.
ER-Diagram
Query
Customer
Issue
Card
Withdraw Money
Customer
Customer Details
Card File
Card Details
Customer
5
Customer Details
Withdraw Amount
Update Balance
Customer File
Customer Details
Query
Customer
Issue
Customer
Print Details
1 2
Issue Card
Card File
Customer Details
Query Customer
Customer File
Customer Details
Customer Details
Withdraw Amount
Withdraw Slip
Customer
START
MENU
Input Ch
STOP
1. New Customer 2. Delete Customer 3. Customer Report 0. Exit Enter your Choice : Input Ch
c1
c2
c3
MENU
c1
c2
Open master file client.dat in read mode. Open transaction file in write mode
Read all the records from master file and write in transaction file accept the record to be deleted.
Open master file client.dat in write mode. Open transaction file in read mode
Read all the records from transaction file and write in master file.
c3
Open master file client.dat in read mode. Open transaction file in write mode
Read all the records from master file and write in transaction file with updation.
Open master file client.dat in write mode. Open transaction file in read mode
Read all the records from transaction file and write in master file.
1. Add new Card 2. Delete Card record 3. Exit Enter your Choice : Input Ch
f1
f2
Y MENU
f1
f2
Open master file card.dat in read mode. Open transaction file in write mode
Read all the records from master file and write in transaction file accept the record to be deleted.
Open master file card.dat in write mode. Open transaction file in read mode
Read all the records from transaction file and write in master file.
r1
r2
Y MENU
r1
if eof
r2
if eof
CONCLUSION
This project is designed to meet the requirements of a Credit Card Company. It has been developed in C++ and the database has been built in C++ binary file only, keeping in mind the specifications of the system. For designing the system we have used simple data flow diagrams. Overall the project teaches us the essential skills like: 1. Using system analysis and design techniques like data flow diagram in designing the system. 2. Understanding programming logic and language in C++.
BIBLIOGRAPHY
1.
2.
3.