0% found this document useful (0 votes)
160 views

File Structure Report New

The document describes a mini project on an Automobile Management System developed by two students. The system aims to manage details of customers, bookings, automobiles, charges and services to reduce manual work. It allows searching vehicles by ID or name. The project was developed using C++ and submitted to fulfill B.E. degree requirements. It was guided by two professors and approved by the Head of Department. The document includes an abstract describing the system's functions, a description of objectives, acknowledgements and a table of contents.

Uploaded by

Raushan Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
160 views

File Structure Report New

The document describes a mini project on an Automobile Management System developed by two students. The system aims to manage details of customers, bookings, automobiles, charges and services to reduce manual work. It allows searching vehicles by ID or name. The project was developed using C++ and submitted to fulfill B.E. degree requirements. It was guided by two professors and approved by the Head of Department. The document includes an abstract describing the system's functions, a description of objectives, acknowledgements and a table of contents.

Uploaded by

Raushan Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELGAUM - 590014

A MINI PROJECT SYNOPSIS ON

“C++ Project on Automobile Management System”


Submitted By

ROHIT KUMAR UTKARSH


MISHRA MISHRA
(1KN16IS026) (1KN16IS037)
Submitted in the partial fulfillment of the requirements for
The award of Degree

BACHELOR OF ENGINEERING
IN
INFORMATION SCIENCE

UNDER THE GUIDANCE OF

Mr. ATEEQ AHMED Mr.ZABIULLA


Asst. Prof., Dept of CSE Asst. Prof., Dept of ISE

K.N.S INSTITUTE OF TECHNOLOGY


Hegde Nagar, Yelahanka Road, (Off Outer Ring Road)
Tirumenahalli, Bangalore-560 064
2019
ABSTRACT

This Automobile Management System will help their customers to find products as per their query in less
time. User can search any particular auto-mobile using their automobile Id, automobile name .Thus, saving their
time and eliminating the process of searching manually by using Automobile Management System System.
Provides the searching facilities based on various factors. Such as Charges, Services, Automobiles, Customers.

The transactions are executed in off-line mode, hence on-line data for Charges, Booking capture and
modification is not possible.

It tracks all the information of Booking, Delivery, Automobiles etc.

All the fields such as Charges, Services, Customers are validated and does not take invalid values.

It deals with monitoring the information and transactions of Automobiles.

Editing, adding and updating of Records is improved which results in proper resource management of Charges
data.

Integration of all records of Customers & manage the information of Automobiles.

To increase efficiency of managing the Charges, Booking.

DESCRIPTION :-The main objective of the C++ Project on Automobile Management System is to
manage the details of Customers, Booking,Automobiles, Charges, Services. It manages all the information
about Customers, Delivery, Services, Customers.

The project is totally built at administrative end and thus only the administrator is guaranteed the access.

The purpose of the project is to build an application program to reduce the manual work for managing the
Customers, Booking, Delivery, Automobiles. It tracks all the details about the Automobiles, Charges, Services.

This project describes the complete process of selling vehicle to the customer from the dealers showroom. While
executing the process, the dealer can manually maintain the vehicle business transaction type , which means, the
vehicle to sell to the customer.
K.N.S INSTITUTE OF TECHNOLOGY
BANGALORE-560 064
Department of Information Science and Engineering

CERTIFICATE

This is to certify that Utkarsh Mishra (1KN16IS037) and Rohit Kumar


Mishra (1KN16IS026) has successfully completed mini project entitled
"Automobile Management System" in partial fulfillment for the award of
Bachelor of Engineering in Information Science and Engineering of the
VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELGAUM during the
year 2018. The project report has been approved as it satisfies the academic
requirments in respect of project work prescribed for the Bachelor of
Engineering degree.

Signature of the Guide Signature of the Guide Signature of the HOD


Mr. ZABIULLA MR. MOHAMMED
Mr. ATEEQ AHMED
SHAKIR
ASST.PROF. Dept. Of CSE ASST.PROF. Dept. Of ISE
HOD, Dept. Of ISE
KNSIT, BENGALURU KNSIT,BENGALURU
KNSIT,BENGALURU

EXTERNAL Viva

Name of the Examiner Signature with Date

1.................................. 1....................................

2.................................. 2.....................................
ACKNOWLEDGEMENT

The satisfaction that accompanies the success completion of this project would be
incomplete without the mention of the people who made it possible, without whose
constant guidance and encouragement would have made my efforts go in vain.

We consider myself privileged to express gratitude and respect towards all those who
guided me through the completion of this project.

We would like to express my gratitude to Dr. S. M. Prakash, Principal of KNS


INSTITUTE OF TECHNOLOGY for providing us congenial environment and
surrounding to work in.

We would like to express my gratitude to Mr. Mohammed Shakir, Head of the


Department, Department of Information Science and Engineering, KNS
INSTITUTE OF TECHNOLOGY for giving me the support and encouragement that
was necessary for the completion of this project.

We would also like to express my gratitude to Mr. Ateeq Ahmed, Assistant Professor,
Department of Computer Science and Engineering & Mr. Zabiulla, Assistant
Professor, Department of Information Science and Engineering, KNS INSTITUTE
OF TECHNOLOGY for giving me the support and encouragement that was necessary
for the completion of this project.

We would also convey my regards to all other Staff members and non-staff
members and for constantly Motivating and guiding us throughout this study.

Finally, we thank all my friends for their co-operation and their guidance in Bringing out
this project successful.

UTKARSH MISHRA(1KN16IS037)

ROHIT KUMAR MISHRA(1KN16IS026)


TABLE OF CONTENTS

Sl No. Name Page No.

1. Requirement Analysis 1-2

1.1 Software Requirements


1.2 Hardware Requirements
2. System Design 3-5
2.1 System design considerations

3. Project Details & 6-29


Implementation
4. Snapshots 30-33

5. Conclusion 34

6. Bibliography 35
Automobile Management System Requirement Analysis

CHAPTER 1

REQUIRMENT ANALYSIS
The requirement analysis specifies the requirements needed to develop a File Structure project.

Requirements of the project


Data entry operator will enter the information of the Automobiles in database. The Administrator will
enter the price and service charge for each automobile. The customer will come choose the automobile and tell it to
the counter. The bill calculating operator will check the automobile availability with the automobile id then it will
show its information and price and the bill will be calculated and total payment will show. Customer will pay for
the automobile. All the automobile quantity will be shipped and delivered to the customer.

Resource Requirements

The requirements analysis phase of the project can be classified into:

• Hardware Requirements

• Software Requirements

1.1 Software Requirements

i. Microsoft VS Code- Visual Studio Code is a source-code editor developed by Microsoft for Windows.
It includes support for debugging, embedded Git control and GitHub, syntax highlighting, intelligent code
completion, snippets, and code refactoring. It is highly customizable, allowing users to change the theme,
keyboard shortcuts, preferences, and install extensions that add additional functionality.
Visual Studio Code has out-of-the-box support for almost every major programming language.

VI Sem, Dept of ISE, KNSIT 1 2019


Automobile Management System Requirement Analysis

ii. Notepad ++ - Notepad++ is a free source code editor and Notepad replacement that supports several
languages. Running in the MS Windows environment, its use is governed by GPL License. Based on a
powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL
which ensures a higher execution speed and smaller program size. By optimizing as many routines as
possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide
emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting
in a greener environment

iii. Testing- is done via Microsoft VS Code Extension code-runner.

1.2 Hardware Requirements

□ Microsoft windows XP/Vista/Windows 7 / Windows 8/8.1 or Windows 10/LINUX.

□ Processor: 1 gigahertz (GHz) or faster 32-bit (x86) or 64-bit (x64) processor.

□ Memory: 512 MB

□ Disk space: 750 MB of free disk space

□ RAM: 1GB

□ CPU SPEED: 2.9 GHz

□ Mouse: Standard

VI Sem, Dept of ISE, KNSIT 2 2019


Automobile Management System Design

CHAPTER 2
SYSTEM DESIGN

Aim: The project is on Automobile Management. Automobile Showroom is the place where customers come to
purchase their desirable automobile and pay for that. So, there is need to calculate how many automobiles are sold
and to generate the bill for the customer.

Objectives: The main objectives of system for Automobile Management System are:
In our project we have 2 scenarios. First one is the automobile manager where we will decide the service
charge and price on the automobile and can see the record of any automobile. It will also show if
automobile is available for customers. The second one is the customer who can purchase the automobiles
available and the quantity of automobile they want.

1. The product will come in the store.

2. The Administrator will enter the information of the automobile in database and price and
service charge for each automobile.

3. The customer will come and choose the automobile they want to order and its quantity.

4. The bill calculating operator will enter the automobile Id then it will show its information and price
and the bill will be calculated and total payment will show.

5. Customer will pay for the final cost on the automobile.

6. All the automobile will be shipped and delivered to the customer. The Date on which the order
is initialized is recorded in the system.

VI Sem, Dept. of ISE, KNSIT 3 2019


Automobile Management System Design

2.1 System Design Considerations

The system design process is not a step-by-step adherence of clear procedures and, guidelines. Though,
certain clear procedures and guidelines have emerged in recent days, but still much of design work depends on
knowledge and experience of the designer. When designer starts working on system design, he will face different
type of problems. Many of these will be due to constraints imposed by the user or limitations of the hardware and
software available in the market. Sometimes, it is difficult to enumerate the complexity of the problems and solutions
thereof since the variety of likely problems is so great and no solutions are exactly similar. However, following
considerations should be kept in mind during the system designing phase:

Design Objectives

The primary objective of the design of course, is to deliver the requirements as specified in the feasibility
Reports. In general, the following design objectives should be kept in mind.

Practicality
The system must be stable and can be operated by people with average.

Efficiency
This involves accuracy, timeliness and comprehensiveness to the system output.

Cost
It is desirable to aim for a system with a minimum cost subject to the condition that it must Satisfy all
the requirements

VI Sem, Dept. of ISE, KNSIT 4 2019


Automobile Management System Implementation and Project Details

Flexibility
The system should be modifiable depending on the changing needs of the user. Such modifications should
not entail extensive reconstructing or recreation of software. It should also be portable to different computer systems.

Security
This is very important aspect of the design and should cover areas of hardware reliability, fall back
Procedures, physical security of data and provision for detection of fraud and abuse.

System design involves first logical design and then physical construction of the system. The logical design describes
the structure and characteristics of features, like the outputs, inputs, files, database and procedures. The physical
construction, which follows the logical design, produces actual program software, files and a working system.

VI Sem, Dept of ISE, KNSIT 5 2019


Automobile Management System Implementation and Project Details

CHAPTER 3
PROJECT DETAILS AND IMPLEMENTATION

3.1 Project Details

This Automobile Management System is a simple console application built in C++ without the
use of graphics. This project will help you understand basically two things – use of stream class and file
handling in c++ programming language.

The project is simple to understand, and the source code has been presented in an understandable manner.

The source code for this project is long, over 1000 lines. The code is complete and totally error-free, but
there are rooms for improvement.

Automobile management system is a very simple mini project in C++, built as a console application without
using graphics features. It’s just a demonstration of the use of file handling and stream class in C++
language.

The project is relatively simple to understand as there are just a few features. Understanding the source
code will give you the idea regarding file handling: how to add, remove, edit, and search data or info to
from file.

Listed below are the key features of this project:

□ Display: It shows the report of all the automobiles added in Automobile management system.
□ Add, Remove or modify items: With this feature you can add, remove and modify automobile
details. In add items, you can add information or details such as automobile id, automobile
name, in stock, price, quantity, service charge, and many more.
□ Show user details: This feature allows users to see the automobiles booked and the
corresponding details given for the item while adding the item such as booking date, automobile
name and many more.

VI Sem, Dept of ISE, KNSIT 6 2019


Automobile Management System Implementation and Project Details

3.2 Source code


#include <iostream>
#include <conio.h>
#include <fstream>
#include <string.h>
#include <sstream>
#include <ctime>
#include <ctype.h>
#include <stdio.h>
using namespace std;
class Automobile
{
char automobile_id[20];
char automobile_name[20];
char in_stock[20];
char price[20], service_charge[20];
char buffer[500];

public:
int input();
void output();
string search(char key[], int mode);
void modify(int stocks, int qntity, int mode, char key[]);
void pack();
void unpack();
void Delete();
void Write();
int check_id(char key[]);
friend string check(Automobile obj, char key[]);
friend string auto_calculate(Automobile obj1, char key[]);
friend string final_calculate(Automobile obj1, char key[]);
friend void change_Stock(Automobile obj, int stocks, int qntity, char key[]);
};
class Customer
{
char customer_id[20];
char customer_name[20];
char customer_address[25];
string automobile_orders;
char quantity[5];

VI Sem, Dept of ISE, KNSIT 7 2019


Automobile Management System Implementation and Project Details

char automobile_id[20];
char ordered_date[25];
char buffer[500];

public:
int input();
void output();
int search(char key[]);
void modify(int mode);
void pack();
void unpack();
void Delete();
void Write();
int check_id(char key[]);
string check(Automobile ob, char key[])
{
return ob.search(key, 2);
}
string auto_calculate(Automobile obj1, char key[])
{
return obj1.search(key, 3);
}
friend void change_Stock(Automobile obj, int stocks, int qntity, char key[])
{
obj.modify(stocks, qntity, 2, key);
}
string final_calculate(Automobile obj1, char key[])
{
return obj1.search(key, 1);
}
};
// ::::::::::::::::::DELETE AND CHECK INPUT FUNCTION ON FILES:::::::::::::::::::::::::::::
int check_input(char val[])
{
int flag = 0;
for (int i = 0; i < strlen(val); i++)
{
if (!isdigit(val[i]))
{
flag = 1;
break;
}
}
return flag;
}
void delete_record_automobile()
VI Sem, Dept of ISE, KNSIT 8 2019
Automobile Management System Implementation and Project Details

{
ifstream file;
ofstream temp;
string line;
int i = 0, flag = 0;
file.open("automobile.txt");
temp.open("temp.txt");
file.seekg(0, ios::beg);
while (getline(file, line))
{
for (i = 0; i < line.length(); i++)
{
if (line[i] == '$')
flag = 1;
}
if (flag == 1)
{
flag = 0;
continue;
}
i = 0;
while (line[i] != '$' && line[i] != '#')
{
temp << line[i];
i++;
}
temp << '#';

temp << endl;


}
file.close();
temp.close();
remove("automobile.txt");
rename("temp.txt", "automobile.txt");
}
void delete_record_customer()
{
ifstream file;
ofstream temp;
string line;
int i = 0, flag = 0;
file.open("customer.txt");
temp.open("temp.txt");
file.seekg(0, ios::beg);
while (getline(file, line))
{
VI Sem, Dept of ISE, KNSIT 9 2019
Automobile Management System Implementation and Project Details

for (i = 0; i < line.length(); i++)


{
if (line[i] == '$')
flag = 1;
}
if (flag == 1)
{
flag = 0;
continue;
}
i = 0;
while (line[i] != '$' && line[i] != '#')
{
temp << line[i];
i++;
}
temp << '#';

temp << endl;


}
file.close();
temp.close();
remove("customer.txt");
rename("temp.txt", "customer.txt");
}
// ::::::::::::::::::::AUTOMOBILE CLASS METHODS:::::::::::::::::::::::::
void Automobile::Delete()
{
modify(0, 0, 1, NULL);
}
int Automobile::check_id(char key[])
{
fstream file;
string line;
char id[20];
file.open("automobile.txt", ios::out | ios::in);
while (getline(file, line))
{
for (int i = 0; i < line.length(); i++)
{
if (line[i] == '|')
{
id[i] = '\0';
break;
}
id[i] = line[i];
VI Sem, Dept of ISE, KNSIT 10 2019
Automobile Management System Implementation and Project Details

}
if (strcmp(id, key) == 0)
{
return 1;
}
}
return 0;
}
int Automobile ::input()
{
int flag = 0;
cout << "Enter the Automobile ID:" << endl;
cin >> automobile_id;
flag = check_input(automobile_id);
if (flag == 1)
{
system("CLS");
cout << "AutomobileId should be a Number, TRY AGAIN!!!" << endl;
return 1;
}
flag = check_id(automobile_id);
if (flag == 1)
{
system("CLS");
cout << "Id Already Exist ! Try again with different id !!!!" << endl;
return 1;
}
cout << "Enter the Automobile Name:" << endl;
fflush(stdin);
gets(automobile_name);
cout << "Enter Number of Automobile in Stocks:" << endl;
cin >> in_stock;
flag = check_input(in_stock);
if (flag == 1)
{
system("CLS");
cout << "Stocks should be a Number, TRY AGAIN!!!" << endl;
return 1;
}
cout << "Enter the Price of the Automobile:" << endl;
cin >> price;
flag = check_input(price);
if (flag == 1)
{
system("CLS");
cout << "Price should be a Number, TRY AGAIN!!!" << endl;
VI Sem, Dept of ISE, KNSIT 11 2019
Automobile Management System Implementation and Project Details

return 1;
}
cout << "Enter the Service Charges:" << endl;
cin >> service_charge;
flag = check_input(service_charge);
if (flag == 1)
{
system("CLS");
cout << "ServiceCharge should be a Number, TRY AGAIN!!!" << endl;
return 1;
}
return 0;
}
void Automobile ::output()
{
istream &flush();
fstream file;
string line;
system("CLS");
file.open("automobile.txt", ios::in);
file.seekg(0, ios::beg);
if (file.is_open())
{
while (getline(file, line))
{

for (int i = 0; i < line.length(); i++)


buffer[i] = line[i];
unpack();
cout << " --------------------------------- " << endl;
cout << "Automobile ID:" << automobile_id << endl;
cout << "Automobile Name:" << automobile_name << endl;
cout << "In Stock:" << in_stock << endl;
cout << "Price: " << price << " Rs" << endl;
cout << "Service charge:" << service_charge << endl;
cout << " --------------------------------- " << endl;
}
file.close();
}
else
{

cout << "Error !! cant open file!!File doesn't exist!!" << endl;
}
}
void Automobile::pack()
VI Sem, Dept of ISE, KNSIT 12 2019
Automobile Management System Implementation and Project Details

strcpy(buffer, automobile_id);
strcat(buffer, "|");
strcat(buffer, automobile_name);
strcat(buffer, "|");
strcat(buffer, in_stock);
strcat(buffer, "|");
strcat(buffer, price);
strcat(buffer, "|");
strcat(buffer, service_charge);
strcat(buffer, "|");

strcat(buffer, "#");
}
void Automobile ::unpack()
{

char *ptr = buffer;


while (*ptr != '#')
{
if (*ptr == '|')
*ptr = '\0';
ptr++;
}
ptr = buffer;
strcpy(automobile_id, ptr);
ptr = ptr + strlen(ptr) + 1;
strcpy(automobile_name, ptr);
ptr = ptr + strlen(ptr) + 1;
strcpy(in_stock, ptr);
ptr = ptr + strlen(ptr) + 1;
strcpy(price, ptr);
ptr = ptr + strlen(ptr) + 1;
strcpy(service_charge, ptr);
}
void Automobile ::Write()
{
fstream os("automobile.txt", ios::out | ios::app);
os.write(buffer, strlen(buffer));
os << endl;
os.close();
}
void Automobile ::modify(int stocks = 0, int qntity = 0, int mode = 0, char keys[] = NULL)
{

VI Sem, Dept of ISE, KNSIT 13 2019


Automobile Management System Implementation and Project Details

fstream file;
string line;
char del = '$';
file.open("automobile.txt", ios::in | ios::out);

int found = 0, choice, len;


char key[30];
if (mode == 0 || mode == 1)
{
cout << "enter the automobile id: ";
cin >> key;
}
else if (mode == 2)
{
strcpy(key, keys);
}
if (file.is_open())
{
while (!file.eof() && !found)
{
file.getline(buffer, '#');
len = strlen(buffer);
unpack();
if (strcmp(automobile_id, key) == 0)
{
int pos = file.tellg();
pos = pos - len - 2;
file.seekg(pos, ios::beg);
file << del;
if (mode == 0)
{
cout << "1> Automobile Name " << endl;
cout << "2> In Stocks " << endl;
cout << "3> Price of Automobile " << endl;
cout << "4> Service charge on Automobile " << endl;
cout << "Enter What to Modify: ";
cin >> choice;
switch (choice)
{
case 1:
cout << "Enter the new Automobile Name: ";
fflush(stdin);
gets(automobile_name);
break;
case 2:
cout << "Enter the new Stocks: ";
VI Sem, Dept of ISE, KNSIT 14 2019
Automobile Management System Implementation and Project Details

fflush(stdin);
gets(in_stock);

break;
case 3:
cout << "Enter the new Price: ";
cin >> price;
break;
case 4:
cout << "Enter the new Service Charges:";
cin >> service_charge;
break;
default:
cout << "Invalid input given";
}
}
else if (mode == 2)
{
int val_in_stock = (stocks - qntity);
ostringstream temp;
temp << val_in_stock;
std::string str = temp.str();
char *vlue = const_cast<char *>(str.c_str());
strcpy(in_stock, vlue);

if (!val_in_stock)
{
strcpy(in_stock, "0");
}

cout << "instock : " << in_stock << endl;


}
else if (mode == 1)
{
cout << "Automobile Details Deleted !!!" << endl;
automobile_id[0] = '$';
}
found = 1;
pack();
Write();
}
}
}
else
{
cout << "Error!can't open file !File doesn't exist !! " << endl;
VI Sem, Dept of ISE, KNSIT 15 2019
Automobile Management System Implementation and Project Details

return;
}
if (!found)
cout << "\n The Id does not exist !! TRY AGAIN !!" << endl;
file.close();
delete_record_automobile();
}
string Automobile ::search(char key[], int mode)
{
istream &flush();
fstream file;
string line;
int found = 0;

file.open("automobile.txt", ios::in);
if (file.is_open())
{
while (getline(file, line))
{
for (int i = 0; i < line.length(); i++)
buffer[i] = line[i];
unpack();
if (strcmp(automobile_id, key) == 0)
{
if (mode == 0)
{
system("CLS");
cout << "Automobile Present!!! " << endl;
cout << " --------------------------------- " << endl;
cout << "Automobile ID:" << automobile_id << endl;
cout << "Automobile Name:" << automobile_name << endl;
cout << "In Stock:" << in_stock << endl;
cout << "Price: " << price << " Rs" << endl;
cout << "Service charge:" << service_charge << endl;
cout << " --------------------------------- " << endl;
found = 1;
}
if (mode == 2)
{
return in_stock;
}
else if (mode == 1)
{
unsigned long int cost, charges, total;
stringstream val1(price);
stringstream val2(service_charge);
VI Sem, Dept of ISE, KNSIT 16 2019
Automobile Management System Implementation and Project Details

val1 >> cost;


val2 >> charges;
total = cost + charges;
stringstream ss;
ss << total;
string str = ss.str();

return str;
}
else
{
return automobile_name;
}
}
}
}
else
{
cout << "Error!Can't open file ! file doesn't exist !!" << endl;
}
if (!found)
{
cout << "Automobile Details Not Present!!!" << endl;
return "Details not present";
}
file.close();
return 0;
}
/* :::::::::::::::::::::CUSTOMER CLASS METHODS ::::::::::::::::::::::::*/
void Customer::Delete()
{
modify(1);
}
int Customer::check_id(char key[])
{
fstream file;
string line;
char id[20];
file.open("customer.txt", ios::out | ios::in);
while (getline(file, line))
{
for (int i = 0; i < line.length(); i++)
{
if (line[i] == '|')
{
id[i] = '\0';
VI Sem, Dept of ISE, KNSIT 17 2019
Automobile Management System Implementation and Project Details

break;
}
id[i] = line[i];
}
if (strcmp(id, key) == 0)
{
return 1;
}
}
return 0;
}
int Customer ::input()
{
Automobile obj;
string in_stock;
int stocks, qntity, flag = 0;
cout << "Enter Customer ID:" << endl;
cin >> customer_id;
flag = check_input(customer_id);
if (flag == 1)
{
system("CLS");
cout << "CustomerId should be a Number, TRY AGAIN!!!" << endl;
return 1;
}
flag = check_id(customer_id);
if (flag == 1)
{
system("CLS");
cout << "Id Already Exist ! Try again with different id !!!!" << endl;
return 1;
}

cout << "Enter Customer Name:" << endl;


fflush(stdin);
gets(customer_name);
cout << "Enter Customer Address:" << endl;
gets(customer_address);
cout << "Enter Automobile ID to Book: " << endl;
cin >> automobile_id;
flag = check_input(automobile_id);
if (flag == 1)
{
system("CLS");
cout << "AutomobileId should be a Number, TRY AGAIN!!!" << endl;
return 1;
VI Sem, Dept of ISE, KNSIT 18 2019
Automobile Management System Implementation and Project Details

}
cout << "Enter the quantity: " << endl;
cin >> quantity;
flag = check_input(quantity);
if (flag == 1)
{
system("CLS");
cout << "Quantity should be a Number, TRY AGAIN!!!" << endl;
return 1;
}
in_stock = check(obj, automobile_id);

if (in_stock == "Details not present")


{
return 1;
}
stringstream val1(in_stock);
stringstream val2(quantity);
val1 >> stocks;
val2 >> qntity;
int i = 0;
if (qntity > stocks)
{
cout << "Enough Stock not available, Available stock: " << in_stock << endl;
return 1;
}
else
{

change_Stock(obj, stocks, qntity, automobile_id);


time_t rawtime;
struct tm *timeinfo;
char time_stamp[80];

time(&rawtime);
timeinfo = localtime(&rawtime);

strftime(time_stamp, sizeof(time_stamp), "%d-%m-%Y", timeinfo);


string str(time_stamp);
for (; i < sizeof(time_stamp); i++)
{
ordered_date[i] = time_stamp[i];
}
ordered_date[i] = '\0';
}

VI Sem, Dept of ISE, KNSIT 19 2019


Automobile Management System Implementation and Project Details

return 0;
}
void Customer ::output()
{
istream &flush();
fstream file;
string line, final_cost;
Automobile obj;
unsigned long int total_cost = 0, qntity = 0;
int i = 0;
system("CLS");
file.open("customer.txt", ios::in);
if (file.is_open())
{
while (getline(file, line))
{

for (i = 0; i < line.length(); i++)


buffer[i] = line[i];
unpack();
automobile_orders = auto_calculate(obj, automobile_id);
final_cost = final_calculate(obj, automobile_id);
if (final_cost != "\0")
{
stringstream val1(final_cost);
stringstream val2(quantity);
val1 >> total_cost;
val2 >> qntity;
total_cost = total_cost * qntity;
}

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


cout << "Customer ID: " << customer_id << endl;
cout << "Customer Name: " << customer_name << endl;
cout << "Customer Address: " << customer_address << endl;
cout << "Quantity: " << quantity << endl;
cout << "Automobile booked: " << automobile_orders << endl;
cout << "Ordered Date:" << ordered_date << endl;
cout << "Total Cost: " << total_cost << " Rs" << endl;
cout << " --------------------------------- " << endl;
}
}
else
{
cout << "Error! can't open file!File doesn't exist !!" << endl;
}
VI Sem, Dept of ISE, KNSIT 20 2019
Automobile Management System Implementation and Project Details

file.close();
}
void Customer ::Write()
{
fstream os("customer.txt", ios::out | ios::app);
os.write(buffer, strlen(buffer));
os << endl;
os.close();
}
void Customer::pack()
{

strcpy(buffer, customer_id);
strcat(buffer, "|");
strcat(buffer, customer_name);
strcat(buffer, "|");
strcat(buffer, customer_address);
strcat(buffer, "|");
strcat(buffer, automobile_id);
strcat(buffer, "|");
strcat(buffer, quantity);
strcat(buffer, "|");
strcat(buffer, ordered_date);
strcat(buffer, "|");
strcat(buffer, "#");
}
void Customer ::unpack()
{

char *ptr = buffer;


while (*ptr != '#')
{
if (*ptr == '|')
*ptr = '\0';
ptr++;
}
ptr = buffer;
strcpy(customer_id, ptr);
ptr = ptr + strlen(ptr) + 1;
strcpy(customer_name, ptr);
ptr = ptr + strlen(ptr) + 1;
strcpy(customer_address, ptr);
ptr = ptr + strlen(ptr) + 1;
strcpy(automobile_id, ptr);
ptr = ptr + strlen(ptr) + 1;
strcpy(quantity, ptr);
VI Sem, Dept of ISE, KNSIT 21 2019
Automobile Management System Implementation and Project Details

ptr = ptr + strlen(ptr) + 1;


strcpy(ordered_date, ptr);
}
int Customer ::search(char key[])
{
Automobile obj;
string final_cost;
unsigned long int total_cost, qntity;
istream &flush();
fstream file;
string line;
int found = 0;
system("CLS");
file.open("customer.txt", ios::in);
if (file.is_open() && !found)
{
while (getline(file, line))
{
for (int i = 0; i < line.length(); i++)
buffer[i] = line[i];
unpack();
automobile_orders = auto_calculate(obj, automobile_id);
final_cost = final_calculate(obj, automobile_id);
if (final_cost != "\0")
{
stringstream val1(final_cost);
stringstream val2(quantity);
val1 >> total_cost;
val2 >> qntity;
total_cost = total_cost * qntity;
}

if (strcmp(customer_id, key) == 0)
{

cout << "Customer Present!!! " << endl;


cout << " -------------------------------- " << endl;
cout << "Customer ID:" << customer_id << endl;
cout << "Customer Name:" << customer_name << endl;
cout << "Customer Address:" << customer_address << endl;
cout << "Quantity: " << quantity << endl;
cout << "Automobile booked: " << automobile_orders << endl;
cout << "Ordered Date:" << ordered_date << endl;
cout << "Total Cost : " << total_cost << " Rs" << endl;
cout << " -------------------------------- " << endl;
found = 1;
VI Sem, Dept of ISE, KNSIT 22 2019
Automobile Management System Implementation and Project Details

}
}
}
else
{
cout << "Can't open file! File doesn't exist !!!" << endl;
return 0;
}

if (!found)
cout << "Customer Details Not Present!!!" << endl;
file.close();
return 0;
}
void Customer ::modify(int mode = 0)
{
Automobile obj;
int stocks, qntity;
fstream file;
string line;
string in_stock;
int i = 0;
istream &flush();
char del = '$';
char key[30];

int found = 0, choice, len;


cout << "Enter The Customer ID: " << endl;
cin >> key;

file.open("customer.txt", ios::in | ios ::out);


file.seekg(0, ios::beg);
if (file.is_open())
{
while (getline(file, line) && !found)
{

for (i = 0; i < line.length(); i++)


buffer[i] = line[i];
buffer[i] = '\0';
len = strlen(buffer);
unpack();

if (strcmp(customer_id, key) == 0)
{

VI Sem, Dept of ISE, KNSIT 23 2019


Automobile Management System Implementation and Project Details

int pos = file.tellg();


pos = pos - len - 1;
file.seekg(pos, ios::beg);
file << del;
if (mode == 0)
{
cout << "1> Customer Name " << endl;
cout << "2> Customer Address " << endl;
cout << "3> Quantity of Automobile " << endl;
cout << "4> Automobile ID " << endl;
cout << "Enter What to Modify: ";
cin >> choice;
switch (choice)
{
case 1:
cout << "Enter the Customer Name: ";
fflush(stdin);
gets(customer_name);
break;
case 2:
cout << "Enter the customer Address: ";
fflush(stdin);
gets(customer_address);
break;
case 3:
cout << "Enter the quantity of Automobile: ";
cin >> quantity;
in_stock = check(obj, automobile_id);

if (in_stock == "Details not present")


{
file.close();
return;
}
else
{
stringstream val1(in_stock);
stringstream val2(quantity);
val1 >> stocks;
val2 >> qntity;
if (qntity > stocks)
{
cout << "Enough Stock not available, Available stock: " << in_stock << endl;
file.close();
return;
}
VI Sem, Dept of ISE, KNSIT 24 2019
Automobile Management System Implementation and Project Details

else
{

change_Stock(obj, stocks, qntity, automobile_id);


}
}
break;
case 4:
cout << "Enter the new Automobile ID:";
cin >> automobile_id;
in_stock = check(obj, automobile_id);
if (in_stock == "Details not present")
{
file.close();
return;
}
else
{
stringstream val1(in_stock);
stringstream val2(quantity);
val1 >> stocks;
val2 >> qntity;
if (qntity > stocks)
{
cout << "Enough Stock not available, Available stock: " << in_stock << endl;
file.close();
return;
}
else
{

change_Stock(obj, stocks, qntity, automobile_id);


}
}
break;
default:
cout << "Invalid input given";
}
}
else if (mode == 1)
{
cout << "Customer Deleted !!!" << endl;
customer_id[0] = '$';
}
found = 1;
pack();
VI Sem, Dept of ISE, KNSIT 25 2019
Automobile Management System Implementation and Project Details

Write();
break;
}
}
}
else
{
cout << "Error! Can't open file !File doesn't exist !!" << endl;
return;
}
if (!found)
{
cout << "\n The Id does not exist !! TRY AGAIN !!" << endl;
file.close();
return;
}
file.close();
delete_record_customer();
}
/*:::::::::::::::::::Automobile menu:::::::::::::::::::*/
void automobile_menu()
{
int choice = 1, flag = 0;
Automobile ob;
system("CLS");
while (choice < 6 && choice > 0)
{
char key[30];

cout << "1> Insert an AutoMobile Info " << endl;


cout << "2> Display all Automobile Info " << endl;
cout << "3> Search for a Automobile: " << endl;
cout << "4> Modify an Automobile Details: " << endl;
cout << "5> Delete an Automobile Details" << endl;
cout << "6> Back to Previous Section " << endl;
cout << "Enter the Choice: ";
cin >> choice;
switch (choice)
{
case 1:
flag = ob.input();
if (!flag)
{
ob.pack();
ob.Write();
}
VI Sem, Dept of ISE, KNSIT 26 2019
Automobile Management System Implementation and Project Details

break;
case 2:

ob.output();
break;
case 3:
cout << "Enter The Automobile ID: " << endl;
cin >> key;
ob.search(key, 0);
break;
case 4:

ob.modify();
break;
case 5:
ob.Delete();
break;
}
}
}
/*:::::::::::::::::::Customer menu:::::::::::::::::::*/
void customer_menu()
{
char key[30];
int choice = 1;
int flag = 0;
Customer custmer;
system("CLS");
while (choice < 6 && choice > 0)
{
cout << "1> Insert A Customer Info " << endl;
cout << "2> Display all Customer Info " << endl;
cout << "3> Search a Customer " << endl;
cout << "4> Modify a Customer Details " << endl;
cout << "5>Delete a Customer Details " << endl;
cout << "6> Back to Previous Section " << endl;
cout << "Enter the choice : ";
cin >> choice;
switch (choice)
{
case 1:
flag = custmer.input();
if (flag == 0)
{
custmer.pack();
custmer.Write();
VI Sem, Dept of ISE, KNSIT 27 2019
Automobile Management System Implementation and Project Details

}
break;
case 2:
custmer.output();
break;
case 3:

cout << "Enter The Customer ID: " << endl;


cin >> key;
custmer.search(key);
break;
case 4:
custmer.modify();
break;
case 5:
custmer.Delete();
break;
}
}
}
main()
{
int choice = 1;
system("CLS");
cout << "::::::::::::::::::::::::::::::::::AUTOMOBILE MANAGEMENT SYSTEM::::::::::::::::::::::::::::::::" <<
endl;
while (choice < 3 && choice > 0)
{
cout << "1> Query Related to Automobile" << endl;
cout << "2>Query Related to Customers" << endl;
cout << "3>Exit" << endl;
cout << "Enter your choice: ";
cin >> choice;
switch (choice)
{
case 1:
automobile_menu();
break;
case 2:
customer_menu();
break;
}
system("CLS");
}
cout << "############## END of the Automobile Management System! Press any key to exit.....
############" << endl;
VI Sem, Dept of ISE, KNSIT 28 2019
Automobile Management System Implementation and Project Details

getch();
return
0;
}

VI Sem, Dept of ISE, KNSIT 29 2019


Automobile Management System Snapshots

Chapter 4
SNAPSHOTS

4.1(a) Main menu for Automobile Management System

4.2(b) Customers Menu

VI Sem, Dept of ISE, KNSIT 30 2019


Automobile Management System Snapshots

4.3(c) Automobiles Menu

4.4(d) All Automobile Details

VI Sem, Dept of ISE, KNSIT 31 2019


Automobile Management System Snapshots

4.5(c) All Customer Details

4.6(d) Modify in Automobile Menu

VI Sem, Dept of ISE, KNSIT 32 2019


Automobile Management System Snapshots

4.7(e) Modify in Customers Menu

4.8(f) Delete in Automobiles Menu

VI Sem, Dept of ISE, KNSIT 33 2019


Automobile Management System Conclusion

CHAPTER 5
CONCLUSION

To conclude the description about the project: The project, developed using C++ is based on the
requirement specification of the user and the analysis of the existing system, with the flexibility for future
enhancement.

Some rooms for improvements in this Automobile Management System project include the addition of function
limiting the values accepted by user.

Identification of the drawbacks of existing System leads to design of computerized system that will be compatible
to the existing system with the system which is more user friendly and more GUI oriented.

We have made full attempt to make the interactive program work correctly.

But as we know

“To err is human to forgive divine”, there might be some Unavoidable errors.

VI Sem, Dept of ISE, KNSIT 34 2019


Automobile Management System Bibliography

BIBLIOGRAPHY

□ http://www.cplusplus.com/forum/beginner/68260/

□ https://codescracker.com/cpp/cpp-date-time.htm

□ https://stackoverflow.com/questions/13540193/edit-modify-delete-of-record-from-a-random-access-
file-in-c

VI Sem, Dept of ISE, KNSIT 35 2019

You might also like