Project Oop Report
Project Oop Report
PROJECT REPORT
GROUP MEMBERS:
NAME:
SEAT.NO:
SEHRISH REHMAN
1214084
ZUBIA SHAHID
2012/comp/BS(SE)/15324
MARYAM MUKHTIAR
1315497
SAMRA SHAUKAT ALI
1315543
ENROLL.NO:
2013/comp/BS(SE)/15484
1315755
2012/comp/BS(SE)/15432
2012/comp/BS(SE)/15479
P a g e 1 | 27
PROJECT PROPOSAL
(CARS SHOWROOM MANAGEMENT
SYSTEM)
PROJECT DESCRIPTION:
This program is based on showroom, in this
program we usually use build in function. Users
have the opportunity to search a new car they also
can view all available cars which we put in our
program. They can also give the detail of a new car
& can see the sold car.
LOGIC OF PROGRAM:
If user wants to see all available cars details they
can, they also enter a new car detail.
We have used switch case in it.
P a g e 2 | 27
PROJECT DESCRIPTION
HEADER FILES:
Our project is based on these Header files.
1.#include<stdio.h>
#' is a symbol that says "next instruction is for pre-processor, not compiler".
#include <stdio.h> does absolutely nothing more than take contents of the
file named "stdio.h" and stick it inside your source file. Simple as that.
2. #include<conio.h>
conio.h is a C header file used in old MS-DOS compilers to create text user
interfaces. It is not described in The C Programming Language book, and it
is not part of the C standard library, ISO C nor is it defined by POSIX.
3. #include<iostream.h>
It contains function prototypes for the standard input and standard
output functions.
4. #include<stdlib.h>
Defines numeric conversion functions, pseudo-random numbers generation
functions, memory allocation, process control functions
It contains the definition of class string from the C++ Standard Library.
P a g e 3 | 27
5. #include<string..h>
It contains function prototypes for C-style string processing functions
Contains the definition of class string from the C++ Standard Library
BUILDIN FUNCTION:
Strcpy
Copies the C string pointed by source into the array pointed by destination,
including the terminating null character (and stopping at that point).
To avoid overflows, the size of the array pointed by destination shall be long
enough to contain the same C string as source (including the terminating null
character), and should not overlap in memory with source.
Cin.getline
Extracts characters from is and stores them into str until a delimitation
character is found.
Cout.width
also
be
modified
using
the
the field
width.
parameterized
Cin
cin is an object of class istream that represents the standard input stream. It
corresponds to the cstdio streamstdin.
Cout
Strcmp
P a g e 4 | 27
This function starts comparing the first character of each string. If they are
equal to each other, it continues with the following pairs until the characters
differ or until a terminating null-character is reached.
void
void
void
void
void
void
void
void
void
void
void
addCars()
setCar()
getCar()
SearchACar()
getCustInfo()
showCustInfo()
InsertCar()
ShowCars()
SearchCar()
BuyCar()
SellCars()
P a g e 5 | 27
2.class Car
class Car is a base class,in this class we put char
engine,char color,char transmission,char name,char fuel
& char price in protected data & in public we use an
empty/default constructor .
3.class HondaCar
class HondaCar is a derive class which is publicly inherit
with base class Vehicle and Car.
4.class customer
class customer is a base class.
P a g e 6 | 27
LOGIC OF PROGRAM
If user want to see all available cars details they
can, they also enter a new car detail.
We use switch case in it.
DRAWBACKS
Every program in the history have some weakness
and flawless, one thing we can vast our program to
put more functions in it and add more classes in it
but any how this is a good program.
P a g e 7 | 27
CODING OF PROJECT
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<stdlib.h>
#include<string.h>
const int max=20;
void InsertCar();
void ShowCars();
void SearchCar();
void BuyCar();
void SellCars();
int index = 0;
int cindex = 0;
class Vehicle
{
protected:
char cname[50];
public:
P a g e 8 | 27
Vehicle()
{}
};
class Car
{
protected:
int id;
char engine[max];
char color[max];
char transmission[max];
char name[max];
char fuel[max];
char price[max];
public:
Car()
{}
};
class HondaCar: public Car, public Vehicle
{
private:
char n[max];
P a g e 9 | 27
public:
HondaCar()
{}
void addCars(int i,char cn[],char n[],char
e[],char t[],char c[],char f[],char p[])
{
id=i;
strcpy(cname,cn);
strcpy(name,n);
strcpy(engine,e);
strcpy(transmission,t);
strcpy(color,c);
strcpy(fuel,f);
strcpy(price,p);
}
void setCar()
{
cout<<"-------------CAR
INFORMATION-------------"<<endl;
cout<<"Enter company Name:";
cin.getline(cname,max);
P a g e 1 0 | 27
cin.getline(cname,max);
cout<<"Enter car name:";
cin.getline(name,max);
cout<<"Enter engine number:";
cin.getline(engine,max);
cout<<"Enter Transmission:";
cin.getline(transmission,max);
cout<<"Enter car color:";
cin.getline(color,max);
cout<<"Enter fuel type:";
cin.getline(fuel,max);
cout<<"Enter car price:";
cin.getline(price,max);
id = index + 1;
}
void getCar()
{
cout.width(5);
cout.setf(ios::left);
cout<<id;
P a g e 1 1 | 27
cout.width(10);
cout<<name;
cout.width(10);
cout<<engine;
cout.width(10);
cout<<color;
cout.width(10);
cout<<fuel;
cout.width(15);
cout<<transmission;
cout.width(10);
cout<<cname;
cout.width(10);
cout<<price;
}
void SearchACar(char * n)
P a g e 1 2 | 27
{
if( strcmp(name,n) == 0 )
{
cout<<"\n\t\t---------------------Car
found--------------------"<<endl;
cout<<endl;
cout<<"S.no Car
Engine Color Fuel
Transmission Company Price"<<endl;
getCar();
cout<<endl;
cout<<"\t\t---------------------*********--------------------"<<endl;
cout<<endl;
}
}
};
class customer
{
private:
char custname[max];
P a g e 1 3 | 27
char day[10];
char carid[10];
char month[10];
char year[10];
char contact[max];
char billno[10];
char qty[10];
char total[max];
public:
customer()
{}
void getCustInfo()
{
cout<<"\n\n**** PLEASE ENTER YOUR
INFORMATION ****\n";
cout<<"Enter customer name:";
cin.getline(custname,max);
cin.getline(custname,max);
cout<<"Enter contact number:";
cin>>contact;
cout<<"Enter car serial number:";
P a g e 1 4 | 27
cin>>carid;
cout<<"Bill no:";
cin>>billno;
cout<<"Quantity:";
cin>>qty;
cout<<"Date:";
cin>>day>>month>>year;
cout<<" Total:";
cin>>total;
cout<<"\t\t*********THANK
YOU**********";
}
void showCustInfo()
{
cout<<"\t\n\n*********Sold Car
Information*********\n\n";
cout<<"Customer:
"<<custname<<endl;
cout<<"Contact number:
"<<contact<<endl;
cout<<"Serial: "<<carid<<endl;
cout<<"BIll no. :"<<billno;
P a g e 1 5 | 27
cout<<"\nQuantity :"<<qty;
cout<<"\nDate To Be
Inserted. :"<<day<<"-"<<month<<"-"<<year<<
endl;
cout<<"Total price:"<<total;
}
};
HondaCar h1[50];
customer cst[100];
void main()
{
char ch = ' ';
h1[0].addCars(1,"Honda","City","1298","Manual","S
ilver ","Petrol","1,498,000");
index++;
h1[1].addCars(2,"Honda","Civic","1797","Manual",
"Metal","Petrol","1,973,000");
index++;
h1[2].addCars(3,"Suzuki","Mehran","796","Manual"
,"Silver","Petrol","575,000");
index++;
P a g e 1 6 | 27
h1[3].addCars(4,"Suzuki","Cultus","993","Manual","
Aque-Blue","Petrol","985,000");
index++;
h1[4].addCars(5,"Suzuki","Swift","1300","Manual","
Silver","Petrol","1,151,000");
index++;
h1[5].addCars(6,"Toyota","Corolla","1298","Manual
","Deep Blue","Petrol","1,554,000");
index++;
h1[6].addCars(7,"Toyota","
Hilux","N/A","Manual","White","Petrol","1,779,200")
;
index++;
h1[7].addCars(8,"Toyota","Prado","2982
","Manual","Green","Petrol","11,99,000");
index++;
h1[8].addCars(9,"Toyota","Camry","2362","Manual"
,"Black","Petrol","7,846,000");
index++;
h1[9].addCars(10,"Toyota","Avanza","1495","Manu
al","Aqua","Petrol","2,549,000");
index++;
h1[10].addCars(11,"Toyota","Altis","1598","Auto","
Mica","Petrol","2,104,500");
P a g e 1 7 | 27
index++;
h1[11].addCars(12,"Suzuki","Liana","1298","Any","
Gray","Petrol","1,432,000 ");
index++;
while(1)
{
clrscr();
cout<<endl<<endl;
cout<<"\n\t\t\tWellcome to Car
Showroom"<<endl<<endl;
cout<<"*******************************************
*************************************"<<endl;
cout<<"\t\t\t***---Press 1 to enter a new
car"<<endl;
cout<<"\t\t\t***---Press 2 to view all available
cars"<<endl;
cout<<"\t\t\t***---Press 3 to Search a car"<<endl;
cout<<"\t\t\t***---Press 4 to see sold cars"<<endl;
cout<<"\t\t\t***---Press 5 to exit the
program"<<endl<<endl;
P a g e 1 8 | 27
cout<<"*******************************************
*************************************"<<endl;
cin>>ch;
char in = ' ';
switch(ch)
{
case '1':
do
{
InsertCar();
cout<<endl;
cout<<"Do you want to insert a new car ?Press
Yes(y) or No(n)"<<endl<<endl;
cin>>in;
}
while( in == 'y');
break;
case '2':
cout<<"S.no Car
Engine Color
Transmission Company Price"<<endl;
Fuel
P a g e 1 9 | 27
ShowCars();
break;
case '3':
SearchCar();
break;
case '4':
SellCars();
break;
case '5':
exit(0);
break;
default:
cout<<"Please enter a valid number"<<endl;
}
getch();
}
}
void InsertCar()
P a g e 2 0 | 27
{
h1[index].setCar();
index++;
}
void ShowCars()
{
if( index != 0 )
{
for(int i=0;i < index; i++)
{
h1[i].getCar();
}
cout<<endl<<endl;
BuyCar();
}
else
{
clrscr();
cout<<endl<<endl<<endl;
cout<<"Cars are not available"<<endl;
P a g e 2 1 | 27
cout<<"************Purchase a
Car***********\n\n";
cout<<"Press y to purchase a car or n to goto
Main menu"<<endl;
cin>>c;
if( c == 'y' || c == 'Y' )
{
cst[cindex].getCustInfo();
cindex++;
}
}
void SellCars()
{
if( cindex != 0 )
{
for( int i=0; i < cindex; i++ )
{
cst[i].showCustInfo();
if( i < index )
{
cout<<"\n";
P a g e 2 3 | 27
Color Fuel
Price"<<endl;
cout<<"S.no Car
Engine
Transmission Company
h1[i].getCar();
}
}
}
else
{
cout<<"No car has sold"<<endl;
cout<<"press any key to
continue......"<<endl;
}
}
SCREEN SHOTS
P a g e 2 4 | 27
MAIN PAGE
P a g e 2 5 | 27
TO PURCHASE A CAR
T
O
SEARCH A
CAR
TO
SEE
SOLD
CARS
P a g e 2 6 | 27
P a g e 2 7 | 27