Computer science Investigatory Project Class 12 C++

48
COMPUTER SCIENCE INVESTIGATORY PROJECT (2015-16) NAME :RUSHIL AGGARWAL CLASS : XII-A ROLL NO :13

Transcript of Computer science Investigatory Project Class 12 C++

Page 1: Computer science Investigatory Project Class 12 C++

COMPUTER SCIENCE INVESTIGATORY

PROJECT

(2015-16)

NAME :RUSHIL AGGARWAL CLASS : XII-A

ROLL NO :13

Page 2: Computer science Investigatory Project Class 12 C++

CERTIFICATE

This is to certified that the project has been satisfactorily performed by Master

RUSHIL AGGARWAL studying in NAVY CHILDREN SCHOOL of class XII-A under the

guidance of Mrs. Smera Girish during the academic year 2015-2016.

Signature of Head Of Department Signature of External Examiner

School Stamp

Page 3: Computer science Investigatory Project Class 12 C++

Acknowledgement

I would like to express my sincere gratitude to my

computer science Teacher Mrs. Smera Girish for their

vital support guidance and encouragement without

which this project would not have come forth from my

side.

I would like to express my heartily gratitude to the lab

incharge , Mr. Vaibhav for his support during the making

of this project .

I would like to thank my parents and friends who have

helped me with their valuable suggestions and guidance

has been helpful in various phases of the completion of

the project.

Page 4: Computer science Investigatory Project Class 12 C++

AIM

INTRODUCTION

HEADER FILES INCLUDED

CODING

OUTPUT

BIBLIOGRAPHY

Contents

Page 5: Computer science Investigatory Project Class 12 C++

AIM

TO CREATE A C++ PROGRAM FOR

PETROL PUMP MANAGEMENT SYSTEM

Page 6: Computer science Investigatory Project Class 12 C++

INTRODUCTION

This program is mainly intended for the various

activities that are carried out at the petrol pump and

service station. In this project we included about how

we can find out the information about the various

operations carried out at a petrol pump.

The program is sub-divided into 4 domains listed below

Add new record

Display all record

Find a record

Exit

Page 7: Computer science Investigatory Project Class 12 C++

Header Files Included

#include<iostream.h>

#include<ctype.h>

#include<string.h>

#include<stdio.h>

#include<dos.h>

#include<iomanip.h>

#include<fstream.h>

#include<process.h>

#include<conio.h>

Page 8: Computer science Investigatory Project Class 12 C++

Bibliography 1. www.google.com

2. www.en.wikipedia.org

3. www.cplusplus.com

4. www.stackoverflow.com

5. Computer Science Textbook class XI & XII –By

Sumita Arora.

Page 9: Computer science Investigatory Project Class 12 C++

CODING //password is 'OIL BARON'

#include<ctype.h>

#include<string.h>

#include<stdio.h>

#include<dos.h>

#include<iomanip.h>

#include<iostream.h>

#include<fstream.h>

#include<process.h>

#include<conio.h>

class pump

{ private :

float totpet,tsalepet,charg,qty;

int totservice,tottyer,sno,pak;

float totdis,tsaledis,tlubric,ratepetrol,ratedisel;

float tsalelubric,tsalelubricpak,tsaleservice,tsaletyer,tlubricpak;

char no[15],item[10];

public:

void end();

void sale(float,float,float,float,float,float);

void stock(float,float,float,int,int,int);

void start();

int service();

void entry(float,float,char*);

int tyers();

void show();

void bill();

void find();

void getdata(char*,int,char *,float,float);

void bill(char

*,float,float,float,float,float,float,int,float,int,float,float);

void password();

}petrol;

void delay(unsigned long time);

void boder(char x);

///////////////////////////////////////////////////////////////////////////////

// MAIN FUNCTION //

///////////////////////////////////////////////////////////////////////////////

void main()

{

clrscr();

char no[15],item[10];

float ratepetrol,ratedisel,ratelub,costlub=0,lub=0,costpak;

float

costservice=0,costtyer=0,litpet=0,costpet=0,litdis=0,costdis=0;

int m=1,d,x=0,sno,choice,choicepet,choicedis,choicelubric;

int pak=0,totservice=0,tottyer=0;

Page 10: Computer science Investigatory Project Class 12 C++

float

totpet=0,tsalepet=0,totdis=0,tsaledis=0,tlubric=0,tsalelubric=0;

float tlubricpak=0,tsalelubricpak=0,tsaleservice=0,tsaletyer=0;

float charg,rs_pk=0,qty;

petrol.start(); //The Welcome screen

clrscr();

petrol.password(); //For Password

boder('#'); //For Border

gotoxy(25,10);

cout<<"Enter the rate of Petrol :: ";

cin>>ratepetrol;

gotoxy(25,13);

cout<<"Enter the rate of Diesel :: ";

cin>>ratedisel;

while(m<4)

{

clrscr();

boder('^');

gotoxy(25,8);

cout<<"Enter [ 1 ] for Add New Record ";

gotoxy(25,10);

cout<<"Enter [ 2 ] for Display All Records ";

gotoxy(25,12);

cout<<"Enter [ 3 ] for Find Any Record ";

gotoxy(25,14);

cout<<"Enter [ 4 ] for Exit ";

gotoxy(25,18);

cout<<"Enter Your Choice Here :: ";

cin>>m;

clrscr();

if(m==1) // TO ADD NEW RECORD

{

d=2;

fstream fill;

fill.open("petfile.dat",ios::app);

int i,j,k;

fill.seekg(0,ios::end);

i=fill.tellg();

j=sizeof(pump);

k=i/j;

j++;

sno=k+1;

gotoxy(10,3);

Page 11: Computer science Investigatory Project Class 12 C++

cout<<"N E W V E H I C L E ";

gotoxy(10,4);

cout<<"---------------------";

gotoxy(10,5);

cout<<"Service Number :: ";

cout<<sno;

gotoxy(10,7);

vno:

gotoxy(3,8);

cout<<"Please enter vehicle number in this format

[hr03c1234] only :: ";

gets(no);

if(strlen(no)==0)

{

gotoxy(10,12);

cout<<"Vehicle Number cannot left blank";

gotoxy(10,14);

cout<<"Enter Vehicle Number please....";

getch();

gotoxy(10,12);

clreol();

gotoxy(10,14);

clreol();

goto vno;

}

for(int r=0;no[r]!='\0';r++) //loop to change name to uppercase

{

no[r]=toupper(no[r]);

}

litpet=costpet=litdis=costdis=lub=costlub=pak=rs_pk=x=costservice=costtyer=0;

while(d>1) //For exit control

{ clrscr();

petrol. entry(ratepetrol,ratedisel,no);

cin>>choice;

switch(choice)

{

case 1: //For Petrol entry

clrscr();

gotoxy(33,2);

strcpy(item,"Petrol");

cout<<"PETROL";

gotoxy(33,3);

Page 12: Computer science Investigatory Project Class 12 C++

cout<<"------\n\n";

gotoxy(10,5);

cout<<"Enter [ 1 ] for Liter\n ";

gotoxy(10,6);

cout<<"Enter [ 2 ] for Rupees ";

gotoxy(10,7);

cout<<"Enter Your Choice (1 or 2) :: ";

cin>>choicepet;

if(choicepet==1) //For entry in Liters(petrol)

{

gotoxy(10,10);

cout<<" How many liters :: ";

cin>>litpet;

totpet=totpet+litpet;

qty=litpet;

costpet=litpet*ratepetrol;

charg=costpet;

tsalepet=tsalepet+costpet;

gotoxy(10,12);

cout<<" Rupees. ";

cout.setf(ios::fixed);

cout<<setprecision(3)<<costpet<<" only ";

gotoxy(50,23);

cout<<"Press Enter key ";

getch();

}

if(choicepet==2) //For entry in Rupees(petrol)

{

gotoxy(10,10);

cout<<" How much Rupees :: ";

cin>>costpet;

charg=costpet;

tsalepet=tsalepet+costpet;

qty=costpet/ratepetrol;

litpet=qty;

totpet=totpet+qty;

gotoxy(10,12);

cout.setf(ios::fixed);

cout<<" Petrol filled "<<setprecision(2)<<qty<<"

liters";

gotoxy(50,23);

cout<<"Press Enter key ";

getch();

}

break;

case 2: //For Diesel entry

clrscr();

Page 13: Computer science Investigatory Project Class 12 C++

strcpy(item,"Diesel");

gotoxy(33,2);

cout<<"DIESEL";

gotoxy(33,3);

cout<<"------";

gotoxy(10,5);

cout<<"Enter [ 1 ] for Liter\n ";

gotoxy(10,6);

cout<<"Enter [ 2 ] for Rupees ";

gotoxy(10,7);

cout<<" \n Enter your choice (1 or 2 ) :: ";

cin>>choicedis;

if(choicedis==1) //For entry in Liters(diesel)

{

gotoxy(10,10);

cout<<"How many liters :: ";

cin>>litdis;

totdis=totdis+litdis;

qty=litdis;

costdis =litdis*ratedisel;

charg=costdis;

tsaledis=tsaledis+costdis;

gotoxy(10,12);

cout.setf(ios::fixed);

cout<<"Rupees :"<<setprecision(2)<<costdis<<" only.";

gotoxy(50,23);

cout<<"Press Enter key ";

getch();

}

if(choicedis==2) //For entry in Rupees(diesel)

{

gotoxy(10,10);

cout<<" How much Rupees :: ";

cin>>costdis;

tsaledis=tsaledis+costdis;

charg=costdis;

qty=costdis/ratedisel;

litdis=qty;

totdis=totdis+qty;

gotoxy(10,12);

cout.setf(ios::fixed);

cout<<"Diesel filled = "<<setprecision(3)<<qty<<" liters ";

gotoxy(50,23);

cout<<"Press Enter key ";

Page 14: Computer science Investigatory Project Class 12 C++

getch();

}

break;

case 3: //Entry for Tyers and tube

clrscr();

strcpy(item,"Tyers");

charg=petrol.tyers();

costtyer=charg;

tottyer++;

tsaletyer=tsaletyer+charg;

gotoxy(50,23);

cout<<"Press Enter key ";

getch();

break;

case 4: //Entry for services

clrscr();

x++;

strcpy(item,"Service");

charg=petrol.service();

qty=0;

costservice=charg;

tsaleservice=charg+tsaleservice;

totservice++;

gotoxy(50,23);

cout<<"Press Enter key ";

getch();

break;

case 5: //Entry for lubricants

clrscr();

strcpy(item,"Lubricant");

gotoxy(33,2);

cout<<"LUBRICANTS";

gotoxy(33,3);

cout<<"----------";

gotoxy(10,5);

cout<<"Enter [ 1 ] for liter ";

gotoxy(10,6);

cout<<"Enter [ 2 ] for Packets";

gotoxy(10,7);

cout<<"Enter Your choice :: ";

cin>>choicelubric;

switch(choicelubric)

{

Page 15: Computer science Investigatory Project Class 12 C++

case 1: //Entry for 'in liters'

gotoxy(10,9);

cout<<"Rate of the oil ::";

cin>>ratelub;

gotoxy(10,10);

cout<<"How many liters :: ";

cin>>lub;

qty=lub;

tlubric=lub+tlubric;

charg=ratelub*lub;

costlub=charg;

tsalelubric=tsalelubric+charg;

gotoxy(10,13);

cout<<"The charges for ";

cout<< lub;

cout<<" liters oil :: ";

cout.setf(ios::fixed);

cout<<setprecision(3)<<charg<<" Rupees only.";

gotoxy(50,23);

cout<<"Press Enter key ";

getch();

break;

case 2: //Entry for 'in Rupees'

gotoxy(10,9);

cout<<"Enter the rate of one packet :: ";

cin>>costpak;

gotoxy(10,10);

cout<<"Enter how many packets you want to buy :: ";

cin>>pak;

qty=pak;

tlubricpak=tlubricpak+pak;

charg=pak*costpak;

rs_pk=charg;

tsalelubricpak=tsalelubricpak+charg;

gotoxy(10,13);

cout<<"The charges for the ";

cout<< pak;

cout<<" packets :: ";

cout.setf(ios::fixed);

cout<<setprecision(3)<<rs_pk<<" Rupees only";

gotoxy(50,23);

cout<<"Press Enter key ";

getch();

break;

}

break;

Page 16: Computer science Investigatory Project Class 12 C++

case 6: //for reveiw for the record(bill)

clrscr();

petrol.bill(no,litpet,costpet,litdis,costdis,lub,costlub,pak,rs_pk,x,

costservice,costtyer);

getch();

break;

case 7:

d=0; //for exit from entry record

break;

}

petrol.getdata(no,sno,item,qty,charg);

fill.write((char*)&petrol,sizeof(petrol));

fill.close();

}

}

if(m==2) //for displaying all records(in file)

{

clrscr();

petrol.show();

}

//for finding a record(in file)

if(m==3)

{

clrscr();

petrol.find();

getch();

}

if(m==4) //for exit from entry record

break;

}

petrol.sale(tsalepet,tsaledis,tsalelubric,tsalelubricpak,tsaleservice,tsaletyer

); // for day's sale

petrol.stock(totpet,totdis,tlubric,tlubricpak,totservice,tottyer);

//for day's stock usage

petrol.end();

} //for end display

Page 17: Computer science Investigatory Project Class 12 C++

//:::::::::::::::::::::::| functions |:::::::::::::::::::::::::::::://

/* ---------------- Function to display Start ---------------------------- */

void pump::start()

{

char a[10][42];

strcpy(a[1],"A P R O G R A M D E V L O P E D ");

strcpy(a[2],"F O R");

strcpy(a[3]," ");

strcpy(a[4],"P E T R O L P U M P M A N A G E M E N T");

strcpy(a[5]," ");

strcpy(a[6]," M A D E B Y");

strcpy(a[7],"R U S H I L A G G A R W A L , XII-A");

strcpy(a[8]," ");

int r=4;

for(int j=1;j<=8;j++)

{

int l=strlen(a[j]);

int x=((80-l)/2)+1;

gotoxy(x,r);

for(int p=0;p<l;p++)

{

putch(a[j][p]);

delay(1000);

}

delay(600);

r=r+2;

if(j==5)

r=r+2;

}

gotoxy(13,24);

cout<<"WAIT FOR MOMENT...";

delay(80000);

}

///////////////////////////////////////////////////////////////////////////////

///////

/* ---------------- Function to display Entry Menu --------------------------

-- */

void pump::entry(float x,float y,char *xx)

{

gotoxy(37,1);

cout<<"MENU";

Page 18: Computer science Investigatory Project Class 12 C++

gotoxy(36,2);

cout<<"------";

gotoxy(27,3);

cout<<"VEHICLE NUMBER :: ";

cout<<xx;

gotoxy(10,5);

cout<<"RATE OF PETROL :: Rs ";

cout.setf(ios::fixed);

cout<<setprecision(2)<<x;

gotoxy(45,5);

cout<<"RATE OF DIESEL :: Rs ";

cout<<setprecision(2)<<y;

gotoxy(30,8);

cout<<"ENTER [ 1 ] FOR PETROL ";

gotoxy(30,10);

cout<<"ENTER [ 2 ] FOR DIESEL ";

gotoxy(30,12);

cout<<"ENTER [ 3 ] FOR TYERS ";

gotoxy(30,14);

cout<<"ENTER [ 4 ] FOR SERVICE ";

gotoxy(30,16);

cout<<"ENTER [ 5 ] FOR LUCBRICANTS ";

gotoxy(30,18);

cout<<"ENTER [ 6 ] FOR DISPLAY CURRENT RECORD ";

gotoxy(30,20);

cout<<"ENTER [ 7 ] FOR EXIT FROM CURRENT RECORD ";

gotoxy(30,24);

cout<<"Enter Your choice :: ";

}

///////////////////////////////////////////////////////////////////////////////

///////

/* ---------------- Function to charge services ----------------------------

*/

int pump::service()

{

int ch,ch1,charg;

clrscr();

gotoxy(37,3);

cout<<"SERVICES";

gotoxy(37,4);

Page 19: Computer science Investigatory Project Class 12 C++

cout<<"--------";

gotoxy(10,6);

cout<<"Enter [ 1 ] For Washing ";

gotoxy(10,7);

cout<<"Enter [ 2 ] For Internal Cleaning ";

gotoxy(10,8);

cout<<"Enter [ 3 ] For Washing and Polishing ";

gotoxy(10,10);

cout<<"Enter Your choice (1 or 2 or 3) :: ";

cin>>ch;

clrscr();

switch(ch)

{

case 1:

gotoxy(10,7);

cout<<"Enter [ 1 ] For Two Wheeler ";

gotoxy(10,8);

cout<<"Enter [ 2 ] For Four Wheeler ";

gotoxy(10,10);

cout<<"Enter Your choice (1 or 2) :: ";

cin>>ch1;

if(ch1==1)

charg=50;

else

charg=90;

gotoxy(10,13);

cout<<"Washing Charges :: Rs ";

cout<<charg;

break;

case 2:

charg=180;

gotoxy(10,13);

cout<<"Inner Cleaning Charges :: Rs ";

cout<<charg;

break;

case 3:

gotoxy(10,7);

cout<<"Enter [ 1 ] For Two Wheeler \n";

gotoxy(10,9);

cout<<"Enter [ 2 ] For Four Wheeler\n";

gotoxy(10,11);

cout<<"Enter Your Choice (1 or 2) :: ";

cin>>ch1;

if(ch1==1)

charg=60;

Page 20: Computer science Investigatory Project Class 12 C++

else

charg=140;

gotoxy(10,15);

cout<<"Washing and Polishing charges :: Rs ";

cout<<charg;

break;

}

return(charg);

}

///////////////////////////////////////////////////////////////////////////////

/////

/* ---------------- Function to display Stock Usage -------------------------

--- */

void pump::stock(float totpet,float totdis,float tlubric,int tlubricpak,int

totservice,int tottyer)

{

clrscr();

gotoxy(30,2);

cout<<"TODAY'S STOCK USAGE " ;

gotoxy(29,3);

cout<<"----------------------";

gotoxy(14,5);

cout<<"ITEM QUANTITY";

gotoxy(14,6);

cout<<"----- ------------";

gotoxy(12,8);

cout<<"PETROL ";

gotoxy(62,8);

cout<<totpet<<" ltr";

gotoxy(12,10);

cout<<"DIESEL ";

gotoxy(62,10);

cout<<totdis<<" ltr";

gotoxy(12,12);

cout<<"LUBRICANT 1) LITERS";

gotoxy(62,12);

cout<<tlubric<<" ltr";

gotoxy(21,13);

cout<<" 2) PACKETS USED";

gotoxy(62,13);

cout<<tlubricpak;

Page 21: Computer science Investigatory Project Class 12 C++

gotoxy(12,15);

cout<<"VEHICLES SERVICED";

gotoxy(62,15);

cout<<totservice;

gotoxy(12,17);

cout<<"TYERS USED";

gotoxy(62,17);

cout<<tottyer;

gotoxy(10,19);

cout<<"--------------------------------------------------------";

gotoxy(60,24);

cout<<"press any key...";

getch();

}

///////////////////////////////////////////////////////////////////////////////

///////

/* ---------------- Function to display Day's Sale --------------------------

-- */

void pump::sale(float tsalepet,float tsaledis,float tsalelubric,float

tsalelubricpak,float tsaleservice,float tsaletyer)

{ clrscr();

float sale=0;

sale=tsalepet+tsaledis+tsalelubric+tsalelubricpak+tsaleservice+tsaletyer;

gotoxy(30,2);

cout<<"TODAY'S SALE " ;

gotoxy(29,3);

cout<<"--------------";

gotoxy(14,5);

cout<<"ITEM RUPEES";

gotoxy(14,6);

cout<<"----- --------";

gotoxy(12,8);

cout<<"PETROL ";

gotoxy(62,8);

cout.setf(ios::fixed);

cout<<setprecision(2)<<tsalepet;

gotoxy(12,10);

cout<<"DIESEL ";

gotoxy(62,10);

Page 22: Computer science Investigatory Project Class 12 C++

cout<<setprecision(2)<<tsaledis;

gotoxy(12,12);

cout<<"LUBRICANT 1) LITERS";

gotoxy(62,12);

cout<<setprecision(2)<<tsalelubric;

gotoxy(21,13);

cout<<" 2) PACKETS ";

gotoxy(62,13);

cout<<setprecision(2)<<tsalelubricpak;

gotoxy(12,15);

cout<<"VEHICLES SERVICE";

gotoxy(62,15);

cout<<setprecision(2)<<tsaleservice;

gotoxy(12,17);

cout<<"TYERS";

gotoxy(62,17);

cout<<setprecision(2)<<tsaletyer;

gotoxy(10,19);

cout<<"--------------------------------------------------------";

gotoxy(51,21);

cout<<"CASH : ";

cout<<setprecision(2)<<sale;

gotoxy(50,22);

cout<<"-----";

gotoxy(60,24);

cout<<"press any key...";

getch();

}

///////////////////////////////////////////////////////////////////////////////

///////

/* ---------------- Function to display End ---------------------------- */

void pump::end()

{

clrscr();

boder('#');

gotoxy(26,8);

cout<<"T H A N K S F O R U S I N G";

gotoxy(36,10);

cout<<"T H I S";

Page 23: Computer science Investigatory Project Class 12 C++

gotoxy(30,12);

cout<<"P R O G R A M";

gotoxy(58,18);

cout<<"NAME- RUSHIL AGGARWAL";

gotoxy(58,20);

cout<<"CLASS- XII A";

gotoxy(58,22);

cout<<"ROLL No.- 13";

gotoxy(8,22);

cout<<"Press any key to exit ...";

getch();

}

///////////////////////////////////////////////////////////////////////////////

///////

/* ---------------- Function for tyer/tube purchase -------------------------

--- */

int pump::tyers()

{ int ty,choice,tb;

float rt,amount,amount1,rtb,charg;

gotoxy(5,3);

cout<<"Enter [ 1 ] For New Tyre ";

gotoxy(5,4);

cout<<"Enter [ 2 ] For Tube ";

gotoxy(5,5);

cout<<"Enter [ 3 ] For Tyre and Tube " ;

gotoxy(5,7);

cout<<"Enter your choice (1 or 2 or 3) :: ";

cin>>choice;

switch(choice)

{

case 1: //for tyers only

clrscr();

gotoxy(5,3);

cout<<"Enter no of tyers you want to buy :: ";

cin>>ty;

gotoxy(5,4);

cout<<"Cost per tyre :: Rs ";

cin>>rt;

amount=ty*rt;

gotoxy(5,6);

cout<<"The cost of ";

Page 24: Computer science Investigatory Project Class 12 C++

cout<<ty;

cout<<" tyers is :: Rs ";

cout.setf(ios::fixed);

cout<<setprecision(2)<<amount;

break;

case 2: //for tubes only

clrscr();

gotoxy(5,3);

cout<<"How many tubes want to buy :: ";

cin>>tb;

gotoxy(5,4);

cout<<"Cost per tube :: Rs ";

cin>>rtb;

amount=tb*rtb;

gotoxy(5,6);

cout<<"The cost of ";

cout<< tb;

cout<<" tube is :: Rs ";

cout.setf(ios::fixed);

cout<<setprecision(2)<<amount;

break;

case 3: //for tyers and tubes both

clrscr();

gotoxy(5,3);

cout<<"Enter no of tyers you want to buy :: ";

cin>>ty;

gotoxy(5,4);

cout<<"Cost of one tyre :: Rs ";

cin>>rt;

amount1=ty*rt;

gotoxy(5,5);

cout<<"The cost of ";

cout<<ty;

cout<<" tyers is :: Rs ";

cout.setf(ios::fixed);

cout<<setprecision(2)<<amount1;

gotoxy(5,7);

cout<<"How many tubes want to buy :: ";

cin>>tb;

gotoxy(5,8);

cout<<"Cost per tube :: Rs ";

cin>>rtb;

charg=tb*rtb;

gotoxy(5,9);

cout<<"The cost of ";

cout<<tb;

Page 25: Computer science Investigatory Project Class 12 C++

cout<<" tubes is :: Rs ";

cout<<setprecision(2)<<charg;

amount=charg+amount1;

gotoxy(5,12);

cout<<"Total charges for ";

cout<<ty;

cout<<" tyer and ";

cout<<tb;

cout<<"tube :: Rs ";

cout<<setprecision(2)<<amount;

break;

} return(amount);

}

///////////////////////////////////////////////////////////////////////////////

///////

/* ---------------- Function to find a record in file -----------------------

----- */

void pump::find()

{

char no1[15]; int y=0;

fstream file;

clrscr();

file.open("petfile.dat",ios::in|ios::out);

file.seekg(0,ios::beg);

clrscr();

gotoxy(4,6);

cout<<"ENTER VEHICLE NUMBER :: # ";

gets(no1);

for(int p=0;no1[p]!='\0';p++)

{

no1[p]=toupper(no1[p]);

}

file.read((char*)&petrol,sizeof(petrol));

while(!file.eof())

{ if(strcmp(no1,no)==0)

{ y=8;

clrscr();

gotoxy(16,10);

cout<<"The record number is :: ";

cout<<sno;

gotoxy(16,12);

cout<<"Work done ";

cout<<item;

gotoxy(16,14);

Page 26: Computer science Investigatory Project Class 12 C++

cout<<"Charges ";

cout.setf(ios::fixed);

cout<<setprecision(2)<<charg;

getch();

}

file.read((char*)&petrol,sizeof(petrol));

}

file.close();

if(y==0)

{

gotoxy(30,12);

cout<<"No entry of this number ";

}

}

///////////////////////////////////////////////////////////////////////////////

///////

/* ---------------- Function to Display from a file -------------------------

--- */

void pump::show()

{

clrscr();

fstream file;

file.open("petfile.dat",ios::in,ios::out);

file.seekg(0,ios::beg);

int row = 3;

int flag = 0;

char ch;

gotoxy(1,1);

cout<<"S NO. VEHICLE NUMBER WORK DONE QTY

CHARGES";

gotoxy(1,2);

cout<<"-----------------------------------------------------------

----------------------";

while(file.read((char*)&petrol,sizeof(petrol)) )

{

flag = 0;

delay(1000);

gotoxy(3,row);

cout<<sno;

gotoxy(8,row);

cout<<no;

gotoxy(33,row);

cout<<item;

gotoxy(50,row);

cout.setf(ios::fixed);

cout<<setprecision(2)<<qty;

Page 27: Computer science Investigatory Project Class 12 C++

gotoxy(71,row);

cout<<setprecision(2)<<charg;

if( row == 23 )

{

flag = 1;

row = 3;

gotoxy(17,25);

cout<<"Press any key to go back to MAIN MENU....";

ch = getch();

if( ch == 27 )

break;

clrscr();

gotoxy(1,1);

cout<<"S NO. VEHICLE NUMBER WORK DONE QTY CHARGES ";

cout<<"------------------------------------------";

}

else

row = row + 2;

}

if(!flag)

{

gotoxy(20,25);

cout<<"Press any key to go back to MAIN MENU....";

getch();

}

file.close();

}

///////////////////////////////////////////////////////////////////////////////

/* ---------------- Function to assign values(s.number,quantity,charges) -----

----------- */

void pump:: getdata(char* no2,int sno1,char *item1,float qty1,float charg1)

{

strcpy(no,no2);

sno=sno1;

strcpy(item,item1);

qty=qty1;

charg=charg1;

}

///////////////////////////////////////////////////////////////////////////////

/* ---------------- Function to display Bill ---------------------------- */

void pump::bill(char *no,float litpet,float cpet,float litdis,float cdis,float

lubric,float clubric,int pak,float cpak,int service,float cservice,float ctyer)

{

clrscr();

float sale=0;

sale=cpet+cdis+clubric+cpak+cservice+ctyer;

gotoxy(27,1);

Page 28: Computer science Investigatory Project Class 12 C++

cout<<"INDIAN OIL PETROL PUMP AND SERVICE STATION " ;

gotoxy(26,2);

cout<<"---------------------------------------";

gotoxy(30,3);

cout<<"VECHICLE NUMBER # ";

cout<<no;

gotoxy(14,5);

cout<<"ITEM QUANTITY AMOUNT";

gotoxy(14,6);

cout<<"----- ---------- --------";

gotoxy(12,8);

cout<<"PETROL ";

gotoxy(37,8);

cout.setf(ios::fixed);

cout<<setprecision(2)<<litpet;

gotoxy(62,8);

cout<<setprecision(2)<<cpet;

gotoxy(12,10);

cout<<"DIESEL ";

gotoxy(37,10);

cout<<setprecision(2)<<litdis;

gotoxy(62,10);

cout<<setprecision(2)<<cdis;

gotoxy(12,12);

cout<<"LUBRICANT 1) LITERS";

gotoxy(37,12);

cout<<setprecision(2)<<lubric;

gotoxy(62,12);

cout<<setprecision(2)<<clubric;

gotoxy(21,13);

cout<<" 2) PACKETS ";

gotoxy(37,13);

cout<<setprecision(2)<<pak;

gotoxy(63,13);

cout<<setprecision(2)<<cpak;

gotoxy(12,15);

cout<<"SERVICE";

Page 29: Computer science Investigatory Project Class 12 C++

gotoxy(37,15);

cout<<setprecision(2)<<service;

gotoxy(62,15);

cout<<setprecision(4)<<cservice;

gotoxy(12,17);

cout<<"TYERS";

gotoxy(62,17);

cout<<setprecision(2)<<ctyer;

gotoxy(12,19);

cout<<"-----------------------------------------------------------";

gotoxy(51,21);

cout<<"CHARGES : ";

cout<<setprecision(4)<<sale;

gotoxy(50,22);

cout<<"--------";

}

///////////////////////////////////////////////////////////////////////////////

/* ---------------- Function for password verification ----------------------

------ */

void pump::password()

{

char pass[10]={"oil baron"};

char pass1[10];

X:

gotoxy(10,10);

cout<<"Enter password :: ";

gets(pass1);

gotoxy(10,11);

delay(8000);

if(!(strcmp(pass,pass1)==0))

{

gotoxy(20,19);

cout<<"Invalid password";

getch();

clrscr();

goto X;

}

gotoxy(20,22);

cout<<"Correct password ";

delay(80000);

clrscr();

Page 30: Computer science Investigatory Project Class 12 C++

}

///////////////////////////////////////////////////////////////////////////////

///////

/* ---------------- Function for a pause ---------------------------- */

void delay (unsigned long time )

{

while (time>0)

{

int i = 1333333; // This number is equivalent to 100 ms

while (i>0)

{

i--;

}

time--;

}

}

///////////////////////////////////////////////////////////////////////////////

///////////

/* ---------------- Function to display Boder ---------------------------- */

void boder(char x)

{

int i;

for(i=1;i<=80;i++)

{

gotoxy(i,1);

cout<<x;

delay(300);

}

for (i=2;i<=23;i++)

{

gotoxy(80,i);

cout<<x;

delay(300);

}

for (i=80;i>=1;i--)

{

gotoxy(i,24);

cout<<x;

delay(300);

}

for (i=23;i>=2;i--)

{

gotoxy(1,i);

cout<<x;

delay(300);

}

delay(1000);

}

Page 31: Computer science Investigatory Project Class 12 C++

OUTPUT

Page 32: Computer science Investigatory Project Class 12 C++
Page 33: Computer science Investigatory Project Class 12 C++
Page 34: Computer science Investigatory Project Class 12 C++
Page 35: Computer science Investigatory Project Class 12 C++
Page 36: Computer science Investigatory Project Class 12 C++
Page 37: Computer science Investigatory Project Class 12 C++
Page 38: Computer science Investigatory Project Class 12 C++
Page 39: Computer science Investigatory Project Class 12 C++
Page 40: Computer science Investigatory Project Class 12 C++
Page 41: Computer science Investigatory Project Class 12 C++
Page 42: Computer science Investigatory Project Class 12 C++
Page 43: Computer science Investigatory Project Class 12 C++
Page 44: Computer science Investigatory Project Class 12 C++
Page 45: Computer science Investigatory Project Class 12 C++
Page 46: Computer science Investigatory Project Class 12 C++
Page 47: Computer science Investigatory Project Class 12 C++
Page 48: Computer science Investigatory Project Class 12 C++