Download as pdf
Download as pdf
You are on page 1of 22
seano16 (CBSE Projects Chemistry, C++, Physies, Maths, Bolony, IP, WW PROJECT ON AUTOMATION OF A BANK #includeciostream .h> #includecfstrean .h> #includecprocess -h> Hincludecstring .h> #includecstdlib Hincludecstdio .h> #includecctype -h> #includecconio .h> #includecdos .h> Ws J] THIS CLASS CONTATNS FUNCTIONS RELATED TO DRAW BOX ETC. uh class shape « public + void line_hor(int, int, int, char); void line_ver(int, int, int, char); void box(int, int, int, int, char); b J/ THIS CLASS CONTROL ALL THE FUNCTIONS IN THE MENU class control « public = void main_menu(void); void help(void) ; private: void edit_menu(void) ; Py i 7] THES CLASS CONTAINS FUNCTIONS RELATED TO INITIAL DEPOSIT uN class initial « public + void add_to_file(int,char t_nane[3@],char t_address[6@], float); void display list(void); void delete_account (int); void update_balance(int,#loat); void modify(void) ; int last_accno(void) ; Ant found_account (int); char *return_nane(int); char *return_address(int) float give_balance(int); int recordno(int) ; void display(int); private: void modify_account(int,char t_nane[30],char t_address[6@]); void box_for_list(void); int aceno; char name[3@], address [60]; float balance; % We J/ THIS. CLASS CONTAINS FUNCTIONS RELATED TO TRANSACTIONS hitptfreects.cbsecomlopp-118 122 seano16 CBSE Projects Chemistry, C++, Physics, Maths, Biology, IP, class account « public = void new_account(void); void close_account (void) ; void display_account(void); void transaction(void) ; void clear(int, int); private void »_file(int, int, int, int, char,char t_type[10], float, float, float) ; void delete_account (int); int no_of_days(int, int, int, int, int, int) 5 float calculate_interest(int, float) ; void display(int); void box_for_display(int); int aceno; char type[1@];_//Cheque or Cash int ddyam,yy; //Date char tran; // Deposit or withdrawl float interest amount, balance; 77 FUNCTION TO DRAM HORIZONTAL LINE void shape::1ine_hor(int colurnt,int colunn2,int row, char c) € for(column4 ;colunna< { ‘olunn2;colunni++) gotoxy(colunnt,row) 5 coutece; u FUNCTION TO DRAW VERTICAL LINE void shape: :1ine_ver(int rowl,int row2,int column, char ¢) ¢ For(rowl;rowl<=row2;rowi++) « gotoxy(colunn, row); coutece; y y uw FUNCTION TO DRAW BOX LINE void shape: :box(int colunnt, int row1,int coluan2, int row2,char ¢) « char che218; char €1,€2,¢3,c4; char 11=196,12=179; Af(ce=ch) « ca=218; c2=1913 3192; ca-217; 11-196; 12179; y else hitptfreects.cbsecomlopp-118 2m seano16 CBSE Projects Chemistry, C++, Physics, Maths, Biology, IP, « case} =e} caec} lec; lac} x gotoxy (colurnt, row); coutecet; gotoxy (colunn2, row); cout<=154. « delay( 26); gotoxy (1,1) ;elreol(); Y y We //THTS. FUNCTION RETURN LAST ACCOUNT NO. IN THE FILE //INITIAL.DAT #strean file; file.open("INITIAL.DAT", Los: :in); file. seekg(@, ios: :beg); int count=@3 while(file.read((char*)this, sizeof(initial))) file.close(); return count; y Wh //THIS. FUNCTION RETURN RECORD NO. OF THE GIVEN ACCOUNT NO. 7/1 THE FILE INITEAL.DAT Ws int initial: :recoréno(int t_aceno) C fstrean file; file. open("INITIAL.DAT" Jos: file. seekg(0,i0s::beg); int count=03 in); hile (file-read((char*)this, sizeof (initial))) « countess file.close(); return count; y Wh //THIS. FUNTION DISPLAY THE ACCOUNT FOR GIVEN ACCOUNT NO. //PROM THE FILE INITIAL.DAT Ws void in: « al: :display(int t_aceno) shape 5; 8.00x(8,7,73,11,219) 5 fstrean file; file. open("INITIAL.DAT" ios: :n); file. seekg(@, ios: :beg) while(file.read((char*) this, sizeof(i { i#(t_accno! .ceno) hitptfreects.cbsecomlopp-118 6m seano16 (CBSE Projects Chemistry, C++, Physies, Maths, Bolony, IP, gotoxy(8,5); cout <"ACCOUNT NO. “=EXIT"; gotoxy (5,5); coute <"ENTER THE ACCOUNT NO."; gets (t_acc) ; teatoi(t_ace); taccno=t; SF(t_aceno==0) returns elrser()3 S¢( Found, « sccount(t_aceno)) gotoxy(5,5); cout<<"\7ACCOUNT NOT FOUND"; getch(); return; y Shape s3 8-00x(2,2,79524,218) 5 5.Line_hor(3,78,4,196); $.Line_hor(3,78, 22,196) gotoxy(71,1); cout<<"<j@>-EX1T"; ‘textbackground(BLACK) ; gotoxy(3,3)5 for(int in1;ic =76;i4e) eprinte(” ‘textbackground(BLACk) ; ‘textcolon(LIGHTBLUEFBLINK); textbackground(BLACK); gotoxy (32,3); cprint#(*MODIFY ACCOUNT SCREEN"); textcolor(LIGHTBLUE); textbackground(BLACK) ; int diymyt; struct date d; getdate(ad); di=d.da_day; mizd.da_ron; yled.da_years gotoxy(62,5); coutee"DATE: "cdc" char chs display(t_aceno); account a5 do « Mecmlce "ey a.clear(5,13); gotoxy(5,13); cout<<"MODIFY THIS ACCOUNT(Y/N) :"5 cch=getche(); if(che='0") return; ch=toupper(ch) ; Jwhile(cn! S¢(che='N") return; int modified=@, valid; char t_nane[30], t_address[60]; gotoxy(5,15); coute<"NAME 3"; gotoxy (5,16); cout <<" ADDRESS hitptfreects.cbsecomlopp-118 nn seano16 CBSE Projects Chemistry, C++, Physics, Maths, Biology, IP, 40 < a.clear(15,15); a.clear(5,23); gotoxy(5,23); cout<<" ENTER NAME OR PRESS FOR NO CHANG! valide2; gotoxy(15,15); gets(t_nane); steupe(t_aame) iF (t_name[@]=="@") return; if(strlen(t_name)>25) t validse; gotoxy(5, 23); cprintf("\7NAME SHOULD NOT GREATER THAN 25"); geteh(); ? Jwhie(tvalia) ; if(strlen(t_name)>@) odified=1; 40 < a.clear(15,6); a.clear(5,23); xy (S423) 5 ENTER ADDRESS OR PRESS FOR NO CHANGE"; gotoxy(15, 16); gets (t_address) ; strupr(t_address) ; 1 f(t_address[@]=='0") return; Af(strlen(t_address)>55) « validse; gotoxy(5,23) 5 cprint#("\7SHOULD NOT BLANK OR GREATER THAN 5S"); geteh(); > Jwhile(!valid); Sf (strlen(t_address)>0) rodified=1; sf (modified) return; a.clear(5,23); do < a.clear(5,18); gotoxy(5,18); ‘cout< <"DO YOU WANT TO SAVE CHANGES (V/N):"5 ch=getche(); iF(ch=="0") returns ch=toupper (ch); Jwhile(cht="N" && chI="Y"); Af (eh=='N*) return; nodify_account(t_accno, t_nane,t_address); gotoxy(5,21); cout<<"\7RECORD MODIFIED" ; gotoxy (5,23); cout <<"PRESS ANY KEY TO CONTINUE getch(); 7 THIS FUNCTION CLEAR THE GIVEN ROW AND COLUMNS hitptfreects.cbsecomlopp-118 seano16 CBSE Projects Chemistry, C++, Physics, Maths, Biology, IP, void account::clear(int col, int row) « for(int 1=co1;1<=78;i++) « gotoxy(i,row) ; coute<” . y y We //THTS. FUNCTION ADDS THE GIVEN DATA INTO THE FILE //BANKING.DAT MW void account: :add_to_file(int t_accno, int é1,int m, int yt, ‘char t_tran,char t_type[1@],float t_interest, ‘float tanount, float t_balance) fstrean file; Fille. open( "BANKING. DAT", 105: :app); aceno=t_aceno; added; rin=ml; yey: tran=t_tran; strepy(typeyt. balance=t_balance; file.write((char*)this, sizeof(account)) ; file.close(); x Ws //THIS FUNCTION DELETES THE RECORD FOR GIVEN ACCOUNT NO. 7/PROM FILE BANKING. DAT uN void account: :delete_account(int t_aceno) « fstrean file; File.open(“BANKING.DAT", i0s::in); fstrean temp; tenp.open(“tenp.dat", ios: :out); File. seeke(®, 105: :beg); while(I#ile.eof() ) { File.read((char *) this, sizeof (account)); Af(File.c0f()) break; af(accnol= t_accno) temp.write((char *) this,sizeof(account)); } File.close(); tenp.close(); Fille.open("BANKING.DAT" , 10s: :out); tenp.open("tenp.dat,i0s: in); temp. seckg(@, 10s: :beg); wnille(Itemp.e0f()) { ‘tenp.read((char *)this, sizeof(account)); if(tenp.20F()) break; file.write((char *) this, sizeof(account)); } File.close(); temp.close(); y hitptfreects.cbsecomlopp-118 seano16 CBSE Projects Chemistry, C++, Physics, Maths, Biology, IP, uN //TATS FUNCTION ACCEPTS THE DATA TO ADD //PILE BANKING.OAT CORDS. IN THE void account: :new_account (void) « char ch; int i,valid; eirser()5 initial ini; shape 53 5.00x(2,2,79,24,218); s.line_hor(3,78,4,196); s.ine hor (3,78,22,196) ; gotoxy(71,1); coute<"@lt j0>=€XIT"; ‘textbackground(BLACk) ; gotoxy(3,3)3 ‘textbackground(BLACK) ; textcolor (LIGHTBLUE*BLINK) ; textvackground (BLACK); gotoxy(32, 3); eprintF ("OPEN NEW ACCOUNT"); ‘textcolor (LIGHTBLUE) ; ‘textbackground(BLACK) ; int dl,m,y4; struct date 4; getdate(ad); ét-d.da_day; ai=d.da_won; yled.da_years nt t_acenos + accno=ini. last_accno(); tLacenovs; SF (_acen ‘ ini.add_to_file(t_aceno, "abe ini.delete_account (t_aceno); add_to_File(t_accno,,1,1997, delete account (t_aceno)} y char t_nane[30], t[10],t_address[60]; 1) xy2",1.4)5 )MINITIAL"2.1,1.2,1.1); float toal-2.0, t_balance=0.0; gotoxy (5,6); cout cc"DATE:"cedcc"/ecmbcc"/"eeyl gotoxy (5,8); Coute<"ACCOUNT NO. # gotoxy (5,10); Coute<"NAME "5 gotoxy (8,11); cout <<" ADDRESS gotoxy (8,12); out 25) « valid=0; sgotoxy(5,23); printf ("\7NAME SHOULD NOT BLANK OR GREATER THAN 25); getch() 5 y Juhile(tvalid) 5 do « clear(15,11); clear(5,23); gotoxy(5,23); Coute <"ENTER ADDRESS OF THE PERSON"; valid=1; gotoxy(23,11); gets(t_address) ; strupr(t_address) ; Af(t_address[@]=='0") return; i#(strlen(t_address)==0]| strlen(t_address)>55) « valid -0; gotoxy(5,23); cprint#("\7SHOULD NOT BLANK OR GREATER THAN 55"); getch(); y Jwhile( valid); do « char vari(39); clear(5,23)3 gotoxy(5,23); Coute <"ENTER NAME OF THE VARTFYING PERSON"; valid=1 gotoxy (35,12); wets(vari); strupr(vard) 5 if(vari[@}=="0") return; if(strien(vari)es@ || strlen(vari)>25) « gotoxy(5,23)3 eprint#("\7SHOULD NOT BLANK OR GREATER THAN 25"); getch(); y Junile(Ivalid) 5 do « clear(5,23)3 clear(5,23); gotoxy(5,23); Coute <"ENTER INITIAL AMOUNT TO BE DEPOSIT"; vali gotoxy(23,14); gets(t); tbal=atof(t); tbalance-t_bal; iF(t[o]=='0") return; 4¢(t_palancesit;5e8) { valid-o; gotoxy(5,23); eprint#("\7SHOULD NOT LESS THAN S89"); getch(); y hitptfreects.cbsecomlopp-118 seano16 CBSE Projects Chemistry, C++, Physics, Maths, Biology, IP, Jwhile(tvalid) 5 clear(5,23); do < elear(5,37); valid=1; gotoxy(7,21); cout<<"DO YOU WANT TO SAVE THE RECORD (¥/N)" cch=getche(); if(che="0") return; ch=toupper (ch) ; return; float t_anount,t_interest; ‘t_anount=t_balance; + interest=0.03 char t_tran,t_type[1@]; ttrane'D 5 strepy(t_type, "INITIAL") ; ini.adé_to_file(t_accno, t_name,t_address, t_balance) ; add_to_file(t_accno,di,mi,y1,t_tran,t_type,t_interest,t_anount,t_balance) y ut //THIS FUNCTION DRAWS THE BOX FOR DISPLAYING RECORD FROM //PILE BANKING. OAT void account: :b0x_for_display(int t_accno) i shape 53 5.00x(2,1,79,25,218); s.line_hor(3,78,4,196); s.line hor (3,78,6,196); s.Line_hor(3,78,23,296) ‘textbackground(BLACK) ; gotoxy (3,5) for(int {91}4¢=76;444) eprint (" ‘textbackground(BLAck) ; ‘textcolor (LIGHTBLUE); textbackground(BLACK) gotoxy (4,5); eprint(“OATE PARTICULAR DEPOSIT WITHDRAW textcolor (LIGHTBLUE); textbackground(BLACK) ; int d1,mLyi; struct date 4; getdave(ea); ai-d.da_day; ted.da_won; yled.da_years gotoxy (63,2); cout <<" DATE: gotoxy (4,2); coute<"ACCOUNT NO. "=EXIT"; gotoxy(5,5)3 coute <"ENTER THE ACCOUNT NO"; gets (t_acc) ; teatoi(t_ace); +_aceno=! SF(t_aceni Feturn; elrser()3 initial ini; Af(Hini. found_account (t_accno)) « ) gotoxy(s,5); cout <<"\7ACCOUNT NOT FOUND"; getch(); return; y box for_display(t_aceno); int row=7, flag; fstrean file; File.open(*BANKING. DAT", 08: :in); whie(#ile.read((char*)this, sizeoF(account))) accno) flag=0; delay(16); gotoxy(4,row) ; coutecdd <<"/"eenm <<"/" 12) < risa; ylees y 2 WI ya y return days; ul THIS FUNCTION CALCULATES INTEREST float account: :calculate_interest(int t_accno,float t_balance) « fstrean file; file.open file. seekg(@, ios int d1,mi,yi,days; while(file.read((char *)this, sizeof (account))) dos: in); -accno) Ant 42,m2,y25 struct date d; getdate (ad); d2ed.da_day; mzd.da_non; ye=d.da_year Float tinterest: 4€((y2691. 11092: return t_interest; days=no_of_days(d1,m1,y1,d2,m2,y2); int montns=@; Lf(days>=38) { nonths=days/30; t_interest=((t_balance*2)/10@*months) ; y file. close(); return t_interest; THIS FUNCTION MAKES TRANSACTIONS (DEPOSTT/AITHORAW) hitptfreects.cbsecomlopp-118 seano16 CBSE Projects Chemistry, C++, Physics, Maths, Biology, IP, void account: :transaction(void) « eirser(); char t_ace[10]; int t,£_accno, valid; gotoxy(711); coute <"Bltj@>=6X1T"; gotoxy(5,5); coute "ENTER THE ACCOUNT NO."; gets(t_acc); teatoi(t_ace); t_accno=t; SF(t_accno: return; elrser(); initial ini; Sf (Lint. found_account(t_aceno)) { gotoxy(5,5)5 Coutc<"\7ACCOUNT NOT FOUND"; getch(); retura; » shape si 5.b0x(2,2,79,24,218) s-Line_hor(3,78,4,196) ; 5. Line_hor(3,78,22,196) gotoxy(71)1); cout <<"&1tj0>"EXIT"; textbackground(BLACK) ; gotoxy(3,3) for(int 6344) eprint" *); textbackground(BLACK) ; textcolor (LIGHTBLUE*BLINK); textbackground(BLACK) ; gotoxy(29,3); eprint ("TRANSACTION IN ACCOUNT"); textcolor(LIGHTBLUE); textbackground(BLACK) ; Ant dim, y25 struct date d; getdate(ad); disd.da_day; d.da_non; yled.da_years gotoxy(5,6); coute<"OATE: "et_balance) | |(t_anountalt;1)) valid-0; gotoxy(5,23); eprint (*"\7INVALID DATA ENTERED getch(); } Jwhile( valid); char ch; clear(5,23); do { clear (49,20); valid=1; gotoxy(49, 20); cout< <"SAVE TRANSACTION (Y/N): "5 cch=getche(); if(che='0") return; ch=toupper (ch) ; Yuhile(chI=!N" 8B chl="¥"); LF(che="N") return; float t interest; t_interest=calculate_interest(t_aceno,t_balance) ; 27(t_trane='0") + Balance=t_balance+t_anount+t_interest; else t_alance=(t_balance-t_anount)+t_interest; hitptfreects.cbsecomlopp-118 2002 seano16 CBSE Projects Chemistry, C++, Physics, Maths, Biology, IP, ini .update_balance(t_accno, x balance); add_to_file(t_accno,di,m1,y1,t_tran,t_type,t_interest,t_amount,t_balance); 7] THIS FUNCTION CLOSE THE ACCOUNT (DELETE ACCOUNT) Wt void account: :close_account(void) « elrser(); char tacc[10]; int t,t_aceno; gotoxy(72,1); coutec"@lt ;>"8XIT"; gotoxy(5,5)3 coute <"ENTER THE ACCOUNT NO. gets (t_ace); teatoi(t_ace); returns clrser()3 initial ini; Af(ini..found_account (t_accno)) t gotoxy(5,5); cout<<"\7ACCOUNT NOT FOUND"; getcn(); return; > shape s3 $.b0x(2,2,79,24, 218) 5.Line_hor(3,78, 4,196); s.ine_hor(3,78,22,196) gotoxy(71,1); cout<<"@ltj@>-EX11"; ‘textbackground(BLACK) ; gotoxy (3,3) for(int iat;ic =76;i¢4) eprinté(* *); ‘textbackground(BLACk) ; ‘textcolor (GREENELING); textbackground(BLACK) ; gotoxy (32,3); eprintf("CLOSE ACCOUNT SCREEN"); textcolor (LIGHTBLUE); textbackground(BLACK) ; int d1,mLyt; struct date 4; getdate (8a); ai-d.da_day; ted.da_won; yled.da_years gotoxy (62,5); coutee"DATE: “eedace"/ char ch; ink.display(t_aceno); 0 ‘ nce" / "C25 elear(5,15); gotoxy(5,15); cout<<"CLOSE THIS ACCOUNT(Y/N) ch=getche(); iF(ch=="0") returns ch=toupper (ch) ; Jwhile(chl="N" && chl="¥"); i¢(che='N") return; ini delete_account(t_accno); delete_account (t_accno) ; hitptfreects.cbsecomlopp-118 21 seano16 (CBSE Projects Chemistry, C++, Physics, Maths, Biology, IP, Disaster Management gotoxy (5,28); cout <<"\7RECORD DELETED’ gotoxy (5,23); cout<<"PRESS ANY KEY TO CONTINUE..."; getch(); 7/THIS IS MAIN FUNCTION CALLING HELP AND MAIN MENU 1/ FUNCTIONS hi void main(void) « control ¢; cehelp(); comain_menu() x hitptfreects.cbsecomlopp-118 zane

You might also like