Sie sind auf Seite 1von 4

#include<iostream>

#include<string.h>
#include<stdio.h>
#include<ctime>
using namespace std;
class toll
{
int count=0,passcode,pass,ticket,v;
float tax;
char vehicle[100],vehicleno[100];

public:
toll()
{
ticket=1000;
tax=0;
}

bool login()
{
cout<<"Enter the pass code:"<<endl;
cin>>passcode;
if(passcode==1699)
{
cout<<" "<<"********WELCOME TO GSS TOLL SERVICES********"<<"
"<<endl;
return 1;
}
else
{
cout<<" "<<"********INVALID PASS CODE*******"<<" "<<endl;
return 0;
}

void display()
{
cout<<" "<<"----------TOLL CHART------------"<<" "<<endl;
cout<<"**VEHICLE TYPE**"<<" "<<"**SINGAL**"<<" "<<"**MONTHLY
PASS**"<<endl;
cout<<"Two wheeler "<<" "<<" 20 "<<" "<<" 560
"<<endl;
cout<<"Car,Jeep,Van"<<" "<<" 45 "<<" "<<" 1,405
"<<endl;
cout<<"LightCommercialVehicle "<<endl;
cout<<"and Mini Bus"<<" "<<" 65 "<<" "<<" 1,965
"<<endl;
cout<<"Truck and bus"<<" "<<" 130 "<<" "<<" 3,930
"<<endl;
}

void Tax()
{
cout<<"Enter vehicle No. :"<<endl;
gets(vehicleno);
cout<<"Enter the vehicle type: BIKE , SMALL , LCV , HEAVY "<<endl;
gets(vehicle);
count++;
cout<<"PASS REQUIRED: single day:- 1 , Monthly:- 2 "<<endl;
cin>>pass;
tax=calculate(vehicle,pass);
receipt();

void receipt()
{

FILE *f;
f=fopen("Record.txt","a");
cout<<" "<<"******GSS TOLL GATE******"<<" "<<endl;
cout<<"Ticket No. :"<<++ticket<<endl;
cout<<"Booth & Operator :Booth 10 ABC"<<endl;
date();
cout<<"Vehicle Type :"<<vehicle<<endl;
cout<<"Vehicle No. :"<<vehicleno<<endl;
cout<<"Type of Journey :"<<pass<<endl;
cout<<"Fee :Rs."<<tax;
fclose(f);

int calculate(const char* s,int a)


{

if(strcmp(s,"bike")==0)
{
if(a==1)
{
return 20;
}
else
{
return 560;
}
}

if(strcmp(s,"small")==0)
{
if(a==1)
{
return 45;
}
else
{
return 1405;
}
}

if(strcmp(s,"lcv")==0)
{
if(a==1)
{
return 65;
}
else
{
return 1965;
}
}

if(strcmp(s,"heavy")==0)
{
if(a==1)
{
return 130;
}
else
{
return 3930;
}
}
return 0;
}

int date()
{
time_t tt;
struct tm * ti;
time(&tt);
ti=localtime(&tt);
cout<<"Day Month Date hh:mm:ss year "<<endl;
cout<<asctime(ti)<<endl;
return 0;
}

};

int main()
{
toll t;
int choice,res;
res=t.login();
if(res==1)
{
t.display();
while(1)
{
cout<<"\nPlease Enter your choice 1.continue 2.Exit :"<<endl;
cin>>choice;
switch(choice)
{
case 1:t.Tax();
break;
case 2:exit(0);
default:cout<<"Invalid choice"<<endl;
break;

}
}
}
return 0;
}

Das könnte Ihnen auch gefallen