Beruflich Dokumente
Kultur Dokumente
VEHICLE MANAGEMENT
SUBMITTED BY
PRATYAKSH JAIN
15CSE50
MDU
ACKNOWLEDGEMENT
It is my pleasure to place on record my deep sense
of gratitude to our respected computer teacher Mrs Neha
Sehrawat for their deep interest, support and guidance
throughout the course of this project work. I am indebted to
parents for the inspiration and help given to me to do this
project. My thanks are due to my classmates for helping us to
make our project a better one. Above all, I thank God for
enabling me to do this project work and come out victorious.
CONTENTS
1. OVERVIEW OF C++
3. SYSTEM REQUIREMENTS
5. HEADER FILES
7. SOURCE CODE
8. SAMPLE OUTPUT
9. CONCLUISION
10. BIBLIOGRAPHY
OVERVIEW OF C++
Programming language provides various ways of
specifying programs for computer to work. Unlike natural
language programming languages are designed to permit no
ambiguity and to be concise. C++ is a general purpose
programming language. C++ is regarded as a mid level
language, as it comprises a combination of both high level
and low level language features. It is a statically typed, free-
form, multi-paradigm, usually compiled language supporting
procedural programming, data abstraction, oop’s, generic
programming.
The C++ programming was developed at AT & T Bell
laboratories.
In the early 1980’s by Bjarane Stroustrup. He founded ‘C’
lacking for simultaneous and decided to extend the language
by adding features from his favourite language, simula 67.
Simula 67 was one of the earliest object oriented languages.
The name C++ was coined by Rick Mascitti where “++” is the
C increment operator. Ever since its birth C++ evolved to cope
up with problems encountered by users and through
discussion at AT & T. However the maturation of the C++
language is attested to buy two recent events.
1. Formation of ANSI(American National Standard
Institute) C++ committee.
2. The publication of the annotated C++ reference
manual by Ellis and Stroustrup.
C++ provides a predefined set of data types for handling
the data to users. The data can either be fundamental or
derived. The derived data types in C++ comes in two groups,
built in types and user defined types. Data can be stored in
any of these data types.
C++ introduces some object-oriented features to see. It
offers classes, which provide four features commonly, present
in object-oriented languages: abstraction, encapsulation,
inheritance and polymorphism.
C++ is very rich in operators. In fact C++ places more
significance on operators than most other computer
languages do. C++ offers different classes of operators:
arithmetic,relational,logical,increment/decrement,
conditional, bit wise etc. In addition C++ has some special
operators for particular tasks. Each operator performs a
specific task it is designed for.
SYSTEM REQUIREMENTS
HARDWARE
SOFTWARE
HEADER FILES
iostream.h-----The header file declares the basic C++
streams I/O routines
conio.h-----The commonly used function clrscr ( ) that
clears the output screen is included in this header file.
string.h----The header file declares several string
manipulations memory manipulation routines like
strcmp( ) (function used for comparing two strings).
fstream.h----The header file used for doing the various
file handling operations
OBJECTS
CA----OBJECT FOR CALLING CAR
MOTO----OBJECT FOR CALLING MOTORBIKE
U[10]----TO STORE THE NUMBER OF CAR
V[10]----TO STORE THE NUMBER OF MOTORBIKE
W[10]----TO STORE THE NUMBER OF HEAVY VEHICLE
FUNCTIONS
READC----TO READ CAR INFORMATION
DISPLAYC----TO DISPLAY CAR INFORMATION
CALCFINEC----TO DO THE CALCULATIONS ABOUT CAR
TOTALCOSTC----TO CALCULATE THE TOTAL COST OF
RENTED CARS
READB----TO READ MOTORBIKE INFORMATION
CALCFINEB----TO DO THE CALCULATIONS ABOUT
MOTORBIKE
TOTALCOSTB----TO CALCULATE THE TOTAL COST OF
RENTED MOTORBIKE
DISPLAYB----TO DISPLAY MOTORBIKE INFORMATION
READJCB----TO READ THE DETAILS OF JCB
DISPLAYJCB----TO DISPLAY THE DETAILS OF JCB
READBUS----TO READ THE DETAILS OF BUS
DISPLAYBUS----TO DISPLAY THE DETAILS OF BUS
READVAN----TO READ THE VALUES OF VAN
DISPLAYVAN----TO DISPLAY THE DETAILS OF VAN
READH----FOR HEAVY VEHICLE DATA ENTRY
TOTALCOSTH----TO CALCULATE TOTAL COST OF RENTED
HEAVY VEHICLES
DISPLAYH----TO DISPLAY THE DETAILS OF RENTED HEAVY
VEHICLES
SOURCE CODE
/*
***********************VEHICLE**DATA**MANAGEMENT**SYSTEM****************
**********
*/
#include<iostream.h>
#include<fstream.h>
#include<stdio.h>
/*
********************************STRUCTURE**EXPENSES***********************
**********
*/
struct expense
float petrol_cost;
float maintenance_cost;
float government_tax;
};
/*
*********************************CLASS***CAR*******************************
**********
*/
class car
public:
char accident_gradec;
char car_type[20];
char companyc[20];
char name_c[20];
float car_cost;
int car_number;
int number_of_daysc;
float total_costc;
float finec;
void readc();
void displayc();
void totalcostc();
void calcfinec();
};
/*
**********************************car**function**one*************************
*********
*/
void car::readc()
char c='n';
cin.ignore();
cin.getline(name_c,20);
cin.ignore();
cin.getline(companyc,20);
cin>>car_number;
cin>>number_of_daysc;
cin>>car_type;
cin>>car_cost;
cout<<"\n"<<"Has an accident been involved? (y/n):";
cin>>c;
if(c=='y'||c=='Y')
calcfinec();
else
accident_gradec='o';
finec=0.0;
/*
********************car**function**two**********************/
void car::calcfinec()
cin>>accident_gradec;
float d;
if(strcmp(companyc,"ferrari")==0)
d=10;
else if(strcmp(companyc,"toyota")==0)
d=9;
else if(strcmp(companyc,"honda")==0)
d=8;
else if(strcmp(companyc,"ford")==0)
//Function to calculate car fine
d=7;
else if(strcmp(companyc,"dodge")==0)
d=6;
else if(strcmp(companyc,"mitsubishi")==0)
d=5;
else if(strcmp(companyc,"skoda")==0)
d=4;
else if(strcmp(companyc,"maruti")==0)
d=3;
else if(strcmp(companyc,"ambassador")==0)
d=2;
//Fine=carcostx(accidentgrade/100)xcompany value
else
d=1;
float e;
if((accident_gradec=='s')||(accident_gradec=='S'))
e=3;
else if((accident_gradec=='m')||(accident_gradec=='M'))
e=5;
else if((accident_gradec=='b')||(accident_gradec=='B'))
e=8;
}
else
e=1;
finec=float(car_cost*(e/100)*d);
/*
******************************car**function**three***************************
**********
*/
void car::totalcostc()
total_costc=(1000*number_of_daysc)+finec;
/*
*****************************car**function**four*****************************
**********
*/
void car::displayc()
puts(name_c);
puts(companyc);
if(accident_gradec=='o')
cout<<"\n"<<"The borrower was not involved in any accident"; //Function to display car
details
cout<<"\n"<<"fine=0";
else
/*
**********************************Class**Motorbike**************************
**********
*/
class motorbike
public:
char accident_gradeb;
char companyb[20];
char name_b[20];
int powerb;
double bike_cost;
int bike_number;
int number_of_daysb;
double total_costb;
double fineb;
void readb();
void displayb();
void totalcostb();
void calcfineb();
};
/*
*****************************motorbike**function**one************************
*********
*/
void motorbike::readb()
char c='n';
cin.ignore();
cin.getline(name_b,20);
cin.getline(companyb,20);
cin>>bike_number;
cout<<"\n"<<"Enter the number of days on rent:";
cin>>number_of_daysb;
cin>>powerb;
cin>>bike_cost;
cin>>c;
if(c=='y'||c=='Y')
calcfineb();
else
accident_gradeb='o';
fineb=0;
/*
*****************************motorbike**function**two************************
*********
*/
void motorbike::calcfineb()
cin>>accident_gradeb;
int d;
if(strcmp(companyb,"Harley davidson")==0)
d=10;
else if(strcmp(companyb,"hayabuza")==0)
d=9;
else if(strcmp(companyb,"honda")==0)
d=8;
else if(strcmp(companyb,"suzuki")==0)
d=7;
d=6;
else if(strcmp(companyb,"mitsubishi")==0)
d=5;
else if(strcmp(companyb,"lotus")==0)
d=4;
else if(strcmp(companyb,"pulsar")==0)
d=3;
else if(strcmp(companyb,"scooter")==0)
d=2;
//Fine=bikecostx(accidentgrade/100)xcompany value
else
d=1;
int e;
if((accident_gradeb=='s')||(accident_gradeb=='S'))
e=3;
}
else if((accident_gradeb=='m')||(accident_gradeb=='M'))
e=5;
else if((accident_gradeb=='b')||(accident_gradeb=='B'))
e=8;
else
e=1;
fineb=double(bike_cost*(e/100)*d);
/*
****************************motorbike**function**three***********************
***********/
void motorbike::totalcostb()
total_costb=500*number_of_daysb+fineb;
/*
****************************motorbike**function**four************************
**********
*/
void motorbike::displayb()
puts(name_b);
puts(companyb);
if(accident_gradeb=='o')
cout<<"\n"<<"The borrower was not involved in any accident"; //Function to display car
details
cout<<"\n"<<"fine=0";
else
/*
*******************************BASE**CLASS**JCB****************************
**********
*/
class JCB
public:
int no_of_jcb;
int no_of_daysjcb;
void readjcb()
cin>>no_of_jcb;
cin>>no_of_daysjcb;
cout<<"\n";
void displayjcb()
};
/*
********************************BASE**CLASS**BUS***************************
**********
*/
class BUS
public:
int no_of_bus;
int no_of_daysbus;
void readbus()
cin>>no_of_bus;
cin>>no_of_daysbus;
cout<<"\n";
void displaybus()
};
/*
*******************************BASE**CLASS**VAN***************************
**********
*/
class VAN
public:
int no_of_van;
int no_of_daysvan;
void readvan()
cin>>no_of_van;
cout<<"\n"<<"Enter the number of days rented:";
cin>>no_of_daysvan;
cout<<"\n";
void displayvan()
cout<<"\n";
};
/*
*****************************DERIVED**CLASS**HEAVY*************************
*********
*/
public:
char name_of_borrowerh[20];
double total_costh;
void readh();
void totalcosth();
void displayh();
};
/*
******************************heavy**function**one**************************
**********
*/
void heavy::readh()
{
cin.getline(name_of_borrowerh,20);
readjcb();
readbus();
readvan();
totalcosth();
/*
**********************************heavy**function**two**********************
**********
*/
void heavy::totalcosth()
total_costh=(no_of_jcb*no_of_daysjcb*435.5)+
( no_of_bus*no_of_daysbus*350.5)+
( no_of_van*no_of_daysvan*300.2);
/*
********************************heavy**function**three***********************
**********
*/
void heavy::displayh()
puts(name_of_borrowerh);
displayjcb();
displaybus();
displayvan();
/*
**********************************Main**Function****************************
**********
*/
int main()
clrscr();
car ca;
motorbike moto;
//Variable declaration
int i,j,k;
int L,m,n;
float t1=0,t2=0,t3=0,tot=0;
float total_expenses;
char abc;
ofstream fout1;
fout1.open("accc.txt",ios::out|ios::app);
cin>>i;
cout<<"\n"<<"How many motorbike records must be entered:"<<"\a";
cin>>j;
cin>>k;
car u[10];
motorbike v[10];
heavy w[10];
L=i;
m=j;
n=k;
fout1.seekp(0);
for(i=0;i<L;i++)
abc='n';
u[i].readc();
u[i].totalcostc();
t1=t1+u[i].total_costc;
getch();
cin>>abc;
if(abc=='y'||abc=='Y')
u[i].displayc();
fout1<<u[i].name_c;
fout1<<"\n"<<"Number of days rented:"<<u[i].number_of_daysc;
fout1<<u[i].companyc;
if(u[i].accident_gradec=='o')
fout1<<"\n"<<"The borrower was not involved in any accident"; //Function to display car
details
fout1<<"\n"<<"fine=0";
else
fout1.close();
ofstream fout2;
fout2.open("accb.txt",ios::out|ios::app);
for(j=0;j<m;j++)
abc='n';
v[j].readb();
v[j].totalcostb();
t2=t2+v[j].total_costb;
cin>>abc;
if(abc=='y'||abc=='Y')
v[j].displayb();
fout2<<v[j].name_b;
fout2<<v[j].companyb;
if(v[j].accident_gradeb=='o')
fout2<<"\n"<<"The borrower was not involved in any accident"; //Function to display car
details
fout2<<"\n"<<"fine=0";
else
fout2.close();
for(k=0;k<n;k++)
abc='n';
w[k].readh();
t3=t3+w[k].total_costh;
cin>>abc;
if(abc=='y'||abc=='Y')
w[k].displayh();
expense exp;
cin>>exp.petrol_cost;
cin>>exp.maintenance_cost;
cout<<"\nEnter the government taxloss:";
cin>>exp.government_tax;
tot=t1+t2+t3-(exp.petrol_cost+exp.maintenance_cost+exp.government_tax);
abc='n';
cin>>abc;
if(abc=='y'||abc=='Y')
ifstream fin1;
fin1.open("accc.txt",ios::in);
fin1.seekg(0);
while(fin1)
fin1.read((char*)&ca,sizeof(ca));
ca.displayc();
fin1.close();
ifstream fin2;
fin2.open("accb.txt",ios::in);
fin2.seekg(0);
while(fin2)
fin2.read((char*)&moto,sizeof(moto));
moto.displayb();
fin2.close();
cout<<"\nAll motorbike accident Records Displayed"<<endl;
cout<<"\n\nEND OF PROGRAM";
getch();
return(0);
//END OF PROGRAM
/*
***************************************************************************
**********
*/
}
OUTPUT SCREEN
CONCLUSION
This project is created in such a way that helps the
user to do the complete management of rented vehicles such
as calculating the fine rate of the vehicle, it also helps to find
the rent to be paid if the vehicles are taken on lease
depending on the number of days which is taken for. It
calculates the total rent to be paid by the lender. It also
calculates the profit made by the vehicle owner.
BIBLIOGRAPHY
THIS PROJECT IS DONE BY REFERING
CLASS XII TEXTBOOK
WIKIPEDIA
GOOGLE
AND OTHER INTERNET SOURCES.