C++

C++ Project on Telephone Billing System

Telephone Billing System

#include”graphics.h” #include #include #include #include #include #include #include #include #include void proj_name(void); void created(void); class consumer {

public:
 long unsigned int tel_no;
 long unsigned int con_no;
 char name[60];
 char add[300];
 char city[40];
 long unsigned int op_rdg;
 long unsigned int cl_rdg;
 long unsigned int met_calls;
 long unsigned int free_calls;
 long unsigned int charge_calls;
 float met_charge;
 float rent;
 float debits;
 float tax;
 float credits;
 float gross_amt;
 float surcharge;
 long unsigned int net_amt_bef;
 long unsigned int net_amt_aft;
public:
  void get_data(void);
  void show_data(void);

};

void consumer::get_data(void) { setfillstyle(1,BLACK); bar(0,0,680,480); consumer g1; int a; char ch; setlinestyle(0,0,3); setcolor(BROWN); settextstyle(1,0,5); outtextxy(90,20,“ENTER THE RECORD:-”); setfillstyle(1,BLACK); bar(50,100,550,400); rectangle(50,100,550,400); gotoxy(10,10); cout< <“TELEPHONE NO. :”; cout<>op_rdg; gotoxy(10,20); cout< <“CLOSING READING :”; cin>>cl_rdg; met_calls=cl_rdg-op_rdg; free_calls=150; rent=360; if(met_calls>debits; tax=(rent+met_charge+debits)/20; gross_amt=(met_charge+rent+tax+debits); gotoxy(10,24); cout< <“CREDITS :”; cin>>credits; if(credits>gross_amt) net_amt_bef=0; else net_amt_bef=gross_amt-credits; if(credits>=gross_amt) surcharge=0; else surcharge=20; net_amt_aft=net_amt_bef+surcharge; }

void consumer::show_data(void) { bar(0,0,660,480); setcolor(RED); settextstyle(8,0,3); outtextxy(55,10,“BHARAT SANCHAR NIGAM LIMITED”); setlinestyle(1,0,3); line(51,40,486,40); gotoxy(10,5); settextstyle(3,0,1); setcolor(BROWN); outtextxy(15,55,“TELEPHONE NO.”); outtextxy(330,55,“CONSUMER NO.”); outtextxy(15,170,“OPENING READING “); outtextxy(15,205,“CLOSING READING “); outtextxy(15,235,“METERED CALLS “); outtextxy(15,268,“FREE CALLS “); outtextxy(15,300,“CHARGABLE CALLS “); setcolor(BROWN); outtextxy(330,170,“METERED CALLS “); outtextxy(330,205,“DEBITS “); outtextxy(330,235,“TAXES “); outtextxy(330,268,“GROSS AMOUNT “); outtextxy(330,300,“CREDITS “); outtextxy(330,140,“RENTAL “); setcolor(MAGENTA); outtextxy(15,327,“AMOUNT PAYABLE IF PAID ON OR BEFORE “); setcolor(BROWN); outtextxy(15,350,“SURCHARGE “); setcolor(MAGENTA); outtextxy(15,377,“AMOUNT PAYABLE IF PAID ON OR AFTER “); setcolor(RED); setlinestyle(0,0,3); bar(70,90,320,160); rectangle(70,90,320,160); gotoxy(20,5); cout< >a; setfillstyle(1,0);

	//TO ADD NEW RECORD

if(a==1) { do {

setfillstyle(1,LIGHTMAGENTA);
bar(0,0,679,679);
settextstyle(1,0,4);
setcolor(BLUE);
outtextxy(90,10,"ENTER THE RECORD:-");
gotoxy(40,9);
long unsigned int tel_no;
outtextxy(50,110,"TELEPHONE_NO :");
cin>>tel_no;
fin.seekg(0);
 do
  {
   fin.read((char*)&g1,sizeof(g1));
if(fin.eof())
break;
if(g1.tel_no==tel_no)
 {
  bar(0,0,679,679);
  settextstyle(1,0,3);
  setfillstyle(1,LIGHTCYAN);
  bar(20,200,610,250);
  outtextxy(20,220,"PERSON WITH THIS TELEPHONE_NO ALREADY EXISTS");
  delay(2000);
  goto u;
  }
}while(!fin.eof());
 fin.close();
 fin.open("m.dat",ios::app|ios::out|ios::in|ios::ate|ios::binary);
 fin.seekg(0,ios::end) ;
 long unsigned int r=fin.tellg();
 long unsigned int t=(r/sizeof(g1))+1;
 con_no=t;
 g1.tel_no=tel_no;
 g1.con_no=con_no;
 g1.get_data();
 fin.write((char*)&g1,sizeof(g1));
 setcolor(RED);
 settextstyle(8,0,4);
 outtextxy(12,420,"ENTER ANY OTHER RECORD(Y/N)");
 setfillstyle(1,4);
 bar(250,450,270,470);
 gotoxy(37,35);
 answer=getche();
}
while ((answer=='Y')||(answer=='y'));
goto u;

}

	  //TO SEE THE RECORDS

else if(a==2) { fin.seekg(0); fin.read((char*)&g1,sizeof(g1)) ; do {

clrscr();
g1.show_data();
fin.read((char*)&g1,sizeof(g1));
getch();

} while(!fin.eof()); fin.close(); goto i; }

	  //FOR ENQUIRY

else if (a==3) { long unsigned int tel_no1; bar(0,0,679,679); setcolor(GREEN); outtextxy(70,150,“ENTER THE TELEPHONE_NO OF PERSON :”); gotoxy(35,15); cin>>tel_no1; bar(0,0,679,679); fin.seekg(0); do {

fin.read((char*)&g1,sizeof(g1));
if(fin.eof())
goto y;
else if(g1.tel_no==tel_no1)
break;

}

while(fin);
g1.show_data();
getch();
goto u;

}

	       //FOR MODIFICATION

else if(a==4) { long unsigned int tel_no2; long unsigned int con_no; char name[60]; char add[300]; char city[40]; long unsigned int op_rdg; long unsigned int cl_rdg; long unsigned int met_calls; long unsigned int free_calls; long unsigned int charge_calls; float met_charge; float rent; float debits; float tax; float credits; float gross_amt; float surcharge; long unsigned int net_amt_bef; long unsigned int net_amt_aft; bar(0,0,679,679); setcolor(MAGENTA); outtextxy(100,150,“ENTER THE TELEPHONE_NO OF PERSON “); outtextxy(100,180,” TO BE MODIFIED “); gotoxy(35,17); cin>>tel_no2; setfillstyle(1,0); fin.seekg(0); do { fin.read((char*)&g1,sizeof(g1)); if(fin.eof())

{
setfillstyle(1,LIGHTMAGENTA);
bar(0,0,679,679);
setfillstyle(1,LIGHTCYAN);
bar(40,200,565,250);
setcolor(BLUE);
settextstyle(1,0,3);
outtextxy(70,220,"DESIRED TELEPHONE_NO DOES NOT EXISTS");
delay(2000);
setfillstyle(1,0);
goto u;
}

if(g1.tel_no==tel_no2)

{
 char ch;
 long unsigned int b=fin.tellg();
 long unsigned int s=sizeof(g1);
 fin.close();
 fin.open("m.dat",ios::out|ios::ate|ios::binary);
 fin.seekp(b-s);
 setfillstyle(1,BLACK);
 bar(0,0,680,480);
 setlinestyle(0,0,3);
 setcolor(BROWN);
 settextstyle(1,0,5);
 outtextxy(90,20,"ENTER THE RECORD:-");
 setfillstyle(1,BLACK);
 bar(50,100,550,400);
 rectangle(50,100,550,400);
 gotoxy(10,10);
 cout< <"TELEPHONE NO.    :";
 cout<>op_rdg;
 gotoxy(10,20);
 cout< <"CLOSING READING  :";
 cin>>cl_rdg;
 met_calls=cl_rdg-op_rdg;
 free_calls=150;
 rent=360;
 if(met_calls>debits;
tax=(rent+met_charge+debits)/20;
gross_amt=(met_charge+rent+tax+debits);
gotoxy(10,24);
cout< <"CREDITS          :";
cin>>credits;
if(credits>gross_amt)
net_amt_bef=0;
else
net_amt_bef=gross_amt-credits;
if(credits>=gross_amt)
surcharge=0;
else
surcharge=20;
net_amt_aft=net_amt_bef+surcharge;
g1.con_no=g1.con_no;
strcpy(g1.name,name);
strcpy(g1.add,add);
strcpy(g1.city,city);
g1.op_rdg=op_rdg;
g1.cl_rdg=cl_rdg;
g1.met_calls=met_calls;
g1.free_calls=free_calls;
g1.charge_calls=charge_calls;
g1.met_charge=met_charge;
g1.rent=rent;
g1.debits=debits;
g1.tax=tax;
g1.credits=credits;
g1.gross_amt=gross_amt;
g1.surcharge=surcharge;
g1.net_amt_bef=net_amt_bef;
g1.net_amt_aft=net_amt_aft;
fin.write((char*)&g1,sizeof(g1));
goto kk;

} }while(fin);

kk:setfillstyle(1,LIGHTMAGENTA); bar(0,0,679,679); setfillstyle(1,LIGHTCYAN); bar(35,200,550,250); setcolor(BLUE); settextstyle(1,0,3); outtextxy(80,220,“RECORD OF THIS PERSON IS MODIFIED”); delay(4000); setfillstyle(1,0); goto u; }

       //FOR EXIT

else { exit(0); }

u:fin.close(); bar(0,0,680,480); goto i;

y:setfillstyle(1,LIGHTMAGENTA); bar(0,0,679,679); settextstyle(TRIPLEX_FONT,0,3); setfillstyle(1,LIGHTCYAN); bar(150,200,490,245); setcolor(BLUE); outtextxy(210,220,“RECORD NOT FOUND”); setfillstyle(1,0); fin.close(); delay(2000); goto u; }

void proj_name(void) { fflush(stdin); int midx,midy; midx=getmaxx()/2; midy=getmaxy()/2; int i,j; setcolor(RED); setlinestyle(1,0,3); setfillstyle(1,CYAN); bar(2,1,660,660); rectangle(2,1,660,660); setcolor(RED); setfillstyle(1,WHITE); bar(25,75,575,425); rectangle(25,75,575,425); setfillstyle(1,CYAN); bar(50,100,550,400); rectangle(50,100,550,400); setcolor(RED); setfillstyle(1,WHITE); bar(75,125,525,375); rectangle(75,125,525,375); setcolor(RED); setfillstyle(1,CYAN); bar(100,150,500,350); rectangle(100,150,500,350); setcolor(RED); settextstyle(0,0,1); settextstyle(1,0,6); settextjustify(CENTER_TEXT,CENTER_TEXT); for(i=170;i< =172;i++) { sleep(1); outtextxy(291,i, “TELEPHONE”); outtextxy(301,i+70, “ BILLING “); outtextxy(331,i+140,“SYSTEM “); } }

void created(void) { fflush(stdin); setfillstyle(1,LIGHTCYAN); rectangle(2,1,660,660); bar(2,1,660,660); setcolor(RED); setlinestyle(1,0,3); settextstyle(1,0,8); settextjustify(LEFT_TEXT,TOP_TEXT); line(10,110,380,110); outtextxy(10,20,“C”); settextstyle(4,0,8); outtextxy(47,20,“reated By:-”); settextstyle(1,0,6); settextjustify(LEFT_TEXT,CENTER_TEXT);

outtextxy(275,250,“MOHIT & ROHIT”);

sleep(1); sleep(1); clrscr(); }

Share: