Rental Car Bike Services project in c++


    “Rental Car/Bike Services

1. INTRODUCTION :

           Our project is a bike & car renting company where a car or bike is rented to customers at fare charges. Today there are many who have to use public transport even for a small traveling requirement & there are people who need a ride for an out of town family vacation or a person who needs a bike to commute within the city. For such requirements, our project becomes one stop solution. Customers can choose from wide range of varieties of cars and bikes & choose the best fare plan which is suitable for them.

 

2. PROBLEM STATEMENT :

The purpose is to provide a vehicle renting platform across the city and to develop an automated system which eliminates the manual interference in a Car/Bike rental organization.

 

3. OBJECTIVE :

Ø The main objective of the Rental Car/Bike Services is to manage the details of Car, Bike, Payment, Customer.

Ø It manages all the information about Car, Bike, Booking.

Ø The purpose of this project is to build a program to reduce the manual work for managing the Car, Bike, Booking, Customer.

 

4. MODULES OF THE PROJECT :

        Our project is divided into two main modules:

        Admin login:

Ø   Add car/bike

Ø Search car/bike 

        Customer:

Ø  customer details

Ø  No. of Days

Ø Rent car/bike

Ø Car/bike booked        

 

5. ALGORITHM :

 

Step 1 : Admin login

Step 2 : Read users choice

              Case 1 : Adding stocks for car and bike in the system.

              Case 2 : searching customer details

              Case 3 : exit

Step 3 : Customer login.

Step 4 : Registration

              Case 1 : Selection of car weather to choose car or bike.

              Case 2 : Selection of different kinds of model (company) and its color.

              Case 3 : Hire duration.

              Case 4 : Asking the user to book car / bike for number of days.

              Case 5 : Rent price (depending upon the number of days).

 Step 5 : customer of the data will be stored.

Step 6 : Go to Step 2.

Step 7 : searching customer by his name / Date.

Step 8 : Data store.

Step 9 : Exit.

DFD:









CFD:





9.SYSTEM REQUIREMENTS:

v Software Requirements:

•Platform: Windows

•Language: C++ Programming Language.

•Software: Code blocks

              

 

v Hardware Requirements:

•Computer System.

 

10. EXPLANATION :

        Basic functioning of the system is registering the new customers, adding the stock of cars/bike, searching the details of customers, suggesting them various options of the cars and bikes, taking inputs regarding the time at which customer needs the vehicle and the time at which he/she wishes to return the vehicle. The last procedure would be the rent. Various rules are communicated to the customer onto who pays the toll, speed limit, vehicle documents and license, driving license etc.

Journey details and vehicle pick-up details are communicated subsequently.

 

11.CONCLUSION –

With this system the car/bike rental transactions become smooth with an automated data storing. Car and Bikes are also rented at a fair price. Functioning of this code is much simpler and people above 18 age group can easily operate, and book their means of transport. Also as there are no manual interventions till the end procedure, the human errors will be totally eliminated.


coustmer program:

#include <iostream>
#include <fstream>
#include<conio.h>
#include <string>
#include <iomanip>
#include<sstream>
#include <bits/stdc++.h>
using namespace std;
string custname , custaddr , fsearch ;
long long custph;
string Shead ,Scompany , Sbike , Scolor , Sqty,Scar,Spatd;
string fhead ,fcompany ,fbike ,fcar,fpatd, fcolor ,fqty,infosearch;
string Cuscompany , Cusbike ,Cuscar, Cuscolor , Cusqty,Cushead,Cuspatd;
long long newphone;
int linee,newww,m,statee , lcheak = 0,Sday;
int addrforcus();
int termsandcondition();
void time()
{
    time_t tmNow;
    tmNow = time(NULL);
    struct tm t = *localtime(&tmNow);

    ofstream fout;

    string line;
    fout.open(infosearch+".csv", ios::app);

    // Execute a loop If file successfully opened
    // Write line in file
    fout << endl<< t.tm_mday << "-" << "0"<<t.tm_mon + 1 << "-" << t.tm_year + 1900 <<",";
    // Close the File
    fout.close();
}

void logincheak()
{
    string cheakname , cheakaddr ,cheakph ,cheakhead;

    addrforcus();
    termsandcondition();

    system("color E4");
    cout<<"\n\n\n\t\t\t\t\tEnter your Full name : ";

    getline(cin>>ws,custname);
    transform(custname.begin(), custname.end(), custname.begin(), ::tolower);

    ifstream logc("custinfo.csv");

    getline(logc,cheakhead,'\n');

    while(logc.peek()!=EOF)
        {
            getline(logc,cheakname,',');
            getline(logc,cheakaddr,',');
            getline(logc,cheakph,'\n');
            if(custname.compare(cheakname)==0)
            {
                lcheak = 1;
                cout<<"\n\n\n\t\t\t\t\t\t********************************";
                cout<<"\n\t\t\t\t\t\t*                              *";
                cout<<"\n\t\t\t\t\t\t*       WELCOME BACK !!!       *";
                cout<<"\n\t\t\t\t\t\t*                              *";
                cout<<"\n\t\t\t\t\t\t********************************";

            }
        }
}

void entry()
{
    details:
    cout<<"\n\t\t\t\t\tEnter your address : ";
    getline(cin>>ws,custaddr);
    mob:
    cout<<"\n\t\t\t\t\tEnter your mobile number : ";
    cin>>custph;
    if(custph>9999999999 || custph<7000000000)
        {
            cout<<"\n\t\t\t\t\tWrong input";
            goto mob;
        }

    cout<<"\n\t\t\t...............................................................................";
    cout<<"\n\n\t\t\t\t\tDo you confirm Below Details\n";
    cout<<"\n\t\t\t\t\tName       : "<<custname<<endl<<"\t\t\t\t\tAddress    : "<<custaddr<<endl<<"\t\t\t\t\tMobile no. : "<<custph<<endl;
    cout<<"\n\t\t\t\t\t1.yes\t\t2.No(try again)\t\t3.Exit\n";
    char PD;
    PD =_getch();
    cout<<"\n\t\t\t\t\t"<<PD;
    cout<<"\n\t\t\t...............................................................................\n";
    switch(PD)
    {
        case 49:
            cout<<"\n\t_______________________________________________________________________________________________________________________________";
            cout<<"\n\n\n\t\t\t\t\t\t********************************";
            cout<<"\n\t\t\t\t\t\t*                              *";
            cout<<"\n\t\t\t\t\t\t*      WELCOME CUSTOMER!!!     *";
            cout<<"\n\t\t\t\t\t\t*                              *";
            cout<<"\n\t\t\t\t\t\t********************************";
            break;
        case 50 :
            goto details;
            break;
        case 51:
            exit(0);
    }
}

void delete_linee(const char *file_name, int n);
void bikebook();
void carbook();

void book()
{
    statee = 0;
    cout<<"\n\n\t\t\t\t\tChoose vehicle\n\n\t\t\t\t\t1.Bike\t\t2.Car";
    char des;
    des=_getch();
    cout<<"\n\n\t\t\t\t\t"<<des;
    switch(des)
    {
        case 49:
            bikebook();
            break;
        case 50:
            carbook();
            break;
    }

}
void carbook()
{
    Sday = 0;
    fsearch = "carstock";
    restartcar:
    cout<<"\n\t\t\t...............................................................................\n";
    cout<<"\n\n\t\t\t\t\tChoose Company\n\n\t\t\t\t\t1.TATA\t\t2.Hyundai\n";//choose company of Car....
    char CScompany;
    SCarcompany:
    CScompany =_getch();
    cout<<"\n\n\t\t\t\t\t"<<CScompany<<endl;
    switch(CScompany)
        {
            case 49:
                Scompany = "TATA";
                cout<<"\n\n\t\t\t\t\tChoose Car\n\n\t\t\t\t\t1.Nexon\t\t2.Tiago\t\t3.Harrier"; // choose Car........
                char TATAcar;
                TATAcar =_getch();
                cout<<"\n\n\t\t\t\t\t"<<TATAcar<<endl;//TATA...................................
                switch(TATAcar)
                {
                    case 49:
                        Scar = "nexon";
                        break;
                    case 50:
                        Scar = "tiago";
                        break;
                    case 51:
                        Scar= "harrier";
                        break;
                }
                break;

            case 50:
                Scompany = "hyundai";
                cout<<"\n\n\t\t\t\t\tChoose Car\n\n\t\t\t\t\t1.i10\t\t2.i20\t\t3.Creta\n"; // choose Car........
                char hyundaicar;
                hyundaicar =_getch();
                cout<<"\n\n\t\t\t\t\t"<<hyundaicar<<endl;//hyndai..................................
                switch(hyundaicar)
                {
                    case 49:
                        Scar = "i10";
                        break;
                    case 50:
                        Scar = "i20";
                        break;
                    case 51:
                        Scar = "creta";
                        break;
                }
                break;

            default :
                goto SCarcompany;
        }

    cout<<"\n\t\t\t...............................................................................\n";
    cout<<"\n\n\t\t\t\t\tChoose color for the Car\n\n\t\t\t\t\t1.White\t\t2.black\n";
    char Ccolor;
    Ccolor =_getch();
    cout<<"\n\n\t\t\t\t\t"<<Ccolor<<endl;
    switch(Ccolor)
    {
        case 49:
            Scolor ="white";
            break;
        case 50:
            Scolor ="black";
            break;
    }
    cout<<"\n\t\t\t...............................................................................\n";
    cout<<"\n\n\t\t\t\t\tChoose type of oil\n\n\t\t\t\t\t1.petrol\t\t2.Diesel\n";
    char patd;
    patd =_getch();
    cout<<"\n\n\t\t\t\t\t"<<patd<<endl;
    switch(patd)
    {
        case 49:
            Spatd ="petrol";
            break;
        case 50:
            Spatd ="disel";
            break;
    }
    cout<<"\n\t\t\t...............................................................................\n";
    cout<<"\n\n\t\t\t\t\tEnter Number of Days you want to book : ";
    cin>>Sday;

    int rent;
    rent = (Sday+400)*6;
    cout<<"\n\n\t\t\t\t\tYour Rent :- "<<rent<<"Rs.";

    ifstream readcar(fsearch+".csv");
    getline(readcar,fhead,'\n');
    while(readcar.peek()!=EOF)
        {
            getline(readcar,fcompany,',');
            getline(readcar,fcar,',');
            getline(readcar,fcolor,',');
            getline(readcar,fpatd,',');
            getline(readcar,fqty,'\n');
            if(Scompany.compare(fcompany)==0)
            {
                if(Scar.compare(fcar)==0)
                {
                    if(Scolor.compare(fcolor)==0)
                    {
                        if(Spatd.compare(fpatd)==0)
                        {
                            if(fqty.compare("0")==0)
                            {
                                cout<<"\n\n\t\t\t\t\tSorry But this CAR is Not available\n\t\t\t\t\tchoose another\n";
                                goto restartcar;
                            }
            else
            {
                cout<<"\n\n\t\t\t\t\t   .............................";
                cout<<"\n\t\t\t\t\t\tYour car is Booked\n";
                cout<<"\t\t\t\t\t   .............................";
                statee = 1;
            }

            infosearch ="carinfo";
            time();
            ofstream client(infosearch+".csv",ios::app);
            client<<custname<<","<<Scompany<<","<<Scar<<","<<Scolor<<","<<Spatd<<","<<Sday;
            client.close();

            if(lcheak == 0 )
                {
                    ofstream pinfo("custinfo.csv",ios::app);
                    pinfo<<endl<<custname<<","<<custaddr<<","<<custph;
                    pinfo.close();
                }
                }
            }
            }
        }
    }
    readcar.close();
    if(statee == 1)
        {
            linee = 0;
            //statee = 0;
            m = 0;
            ifstream readcar("carstock.csv");
            getline(readcar,Cushead,'\n');
            linee = linee+1;
            while(readcar.peek()!=EOF)
            {
                getline(readcar,Cuscompany,',');
                getline(readcar,Cuscar,',');
                getline(readcar,Cuscolor,',');
                getline(readcar,Cuspatd,',');
                getline(readcar,Cusqty,'\n');
                linee = linee+1;
                if(Scompany.compare(Cuscompany)==0)
                {
                    if(Scar.compare(Cuscar)==0)
                    {
                        if(Scolor.compare(Cuscolor)==0)
                        {
                            if(Spatd.compare(Cuspatd)==0)
                            {
                                m = linee;
                                stringstream convert(Cusqty);
                                newww = 0;
                                convert >> newww;
                                statee = 1;
                            }
                        }
                    }
                }
            }
        readcar.close();
        }
    if(statee == 1)
    {
        delete_linee("carstock.csv",m);
        ofstream carst("carstock.csv",ios::app);
        carst<<"\n"<<Scompany<<","<<Scar<<","<<Scolor<<","<<Spatd<<","<<newww-1;
        carst.close();
    }
}

void bikebook()
{
    Sday = 0;
    fsearch = "bikestock";
    restart:
    cout<<"\n\t\t\t...............................................................................\n";
    cout<<"\n\n\t\t\t\t\tChoose Company\n\n\t\t\t\t\t1.Suzuki\t\t2.TVS";//choose company of bike.....
    char BScompany;
    BScompany =_getch();
    cout<<"\n\n\t\t\t\t\t"<<BScompany<<endl;
    switch(BScompany)
    {
        case 49:
            Scompany = "suzuki";
            cout<<"\n\n\t\t\t\t\tChoose Bike\n\n\t\t\t\t\t1.Access125\t\t2.Gixxer\t\t3.Intruder\n"; // choose Bike........
            char suzukiBike;
            suzukiBike =_getch();
            cout<<"\n\n\t\t\t\t\t"<<suzukiBike<<endl;
            switch(suzukiBike)
            {
                case 49:
                    Sbike = "access125";
                    break;
                case 50:
                    Sbike = "gixxer";
                    break;
                case 51:
                    Sbike = "intruder";
                    break;
            }
            break;
        case 50:
            Scompany = "TVS";
            cout<<"\n\n\t\t\t\t\tChoose Bike\n\n\t\t\t\t\t1.Jupiter\t\t2.Star City plus\t\t3.Ntorq\n"; // choose Bike........
            char tvsBike;
            tvsBike =_getch();
            cout<<"\n\n\t\t\t\t\t"<<tvsBike<<endl;
            switch(tvsBike)
            {
                case 49:
                    Sbike = "Jupiter";
                    break;
                case 50:
                    Sbike = "Star city plus";
                    break;
                case 51:
                    Sbike = "Ntorq";
                    break;
            }

    }

    cout<<"\n\t\t\t...............................................................................\n";
    cout<<"\n\n\t\t\t\t\tChoose color for the bike\n\n\t\t\t\t\t1.White\t\t2.black\n";
    char bcolor;
    bcolor =_getch();
    cout<<"\n\n\t\t\t\t\t"<<bcolor<<endl;
    switch(bcolor)
    {
        case 49:
            Scolor ="white";
            break;
        case 50:
            Scolor ="black";
            break;
    }

    cout<<"\n\t\t\t...............................................................................\n";
    cout<<"\n\n\t\t\t\t\tEnter Number of Days you want to book : ";
    cin>>Sday;

    int rent;
    rent = (Sday+400)*6;
    cout<<"\n\n\t\t\t\t\tYour Rent :- "<<rent<<"Rs.";

    ifstream readbike(fsearch+".csv");
    getline(readbike,fhead,'\n');
    while(readbike.peek()!=EOF)
        {
            getline(readbike,fcompany,',');
            getline(readbike,fbike,',');
            getline(readbike,fcolor,',');
            getline(readbike,fqty,'\n');
            if(Scompany.compare(fcompany)==0)
            {
                if(Sbike.compare(fbike)==0)
                {
                    if(Scolor.compare(fcolor)==0)
                    {
                        if(fqty.compare("0")==0)
                        {
                            cout<<"\n\n\t\t\t\t\tSorry But this Bike is Not available\nchoose another\n";
                            goto restart;
                        }
            else
                {
                    cout<<"\n\n\t\t\t\t\t   .............................";
                    cout<<"\n\t\t\t\t\t\tYour car is Booked\n";
                    cout<<"\t\t\t\t\t   .............................";
                    statee = 1;
                }

            infosearch ="bikeinfo";
            time();
            ofstream client(infosearch+".csv",ios::app);
            client<<custname<<","<<Scompany<<","<<Sbike<<","<<Scolor<<","<<Sday;
            client.close();

            if(lcheak == 0 )
                {
                    ofstream pinfo("custinfo.csv",ios::app);
                    pinfo<<endl<<custname<<","<<custaddr<<","<<custph;
                    pinfo.close();
                }
            }
        }
    }
}
    readbike.close();
    if(statee == 1)
        {
            linee = 0;
            //statee = 0;
            m = 0;
            ifstream readbike("bikestock.csv");
            getline(readbike,Cushead,'\n');
            linee = linee+1;
            while(readbike.peek()!=EOF)
            {
                getline(readbike,Cuscompany,',');
                getline(readbike,Cusbike,',');
                getline(readbike,Cuscolor,',');
                getline(readbike,Cusqty,'\n');
                linee = linee+1;
                if(Scompany.compare(Cuscompany)==0)
                {
                    if(Sbike.compare(Cusbike)==0)
                    {
                        if(Scolor.compare(Cuscolor)==0)
                        {
                            m = linee;
                            stringstream convert(Cusqty);
                            newww = 0;
                            convert >> newww;
                            statee = 1;
                        }
                    }
                }
            }
    readbike.close();
    }
    if(statee == 1)
    {
        delete_linee("bikestock.csv",m);
        ofstream bikest("bikestock.csv",ios::app);
        bikest<<"\n"<<Scompany<<","<<Sbike<<","<<Scolor<<","<<newww-1;
        bikest.close();
    }
}

void delete_linee(const char *file_name, int m)
{
    // open file in read mode or in mode
    ifstream iss(file_name);

    // open file in write mode or out mode
    ofstream ofss;
    ofss.open("temp.txt", ofstream::out);

    // loop getting single characters
    char c;
    int line_no =1;
    while (iss.get(c))
    {
        // if a newline character
        if (c == '\n')
        line_no++;

        // file content not to be deleted
        if (line_no != m)
            ofss << c;
    }

    // closing output file
    ofss.close();

    // closing input file
    iss.close();

    // remove the original file
    remove(file_name);

    // rename the file
    rename("temp.txt", file_name);
}

int addrforcus()
{
    system("color C0");
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\t______________________________________________________________________________________________________________________";
    cout<<"\n\n\t\t\t\t\tCompany address:-";
    cout<<"\n\t\t\t\t\t\t\tKasaba Bawada , Near D.Y.Patil medical collage , shop no. 4 , kolhapur , maharashtra";
    cout<<"\n\n\t\t\t______________________________________________________________________________________________________________________";

    cout<<"\n\n\t\t\t\t\tPress... ANY KEY to go ahead >>>";
    getch();
    system("cls");
}

int termsandcondition()
{
    system("color F4");
    cout<<"\n\n\n\t\t\t\t\t\t\t********************************";
    cout<<"\n\t\t\t\t\t\t\t*                              *";
    cout<<"\n\t\t\t\t\t\t\t*     TERMS AND CONDITIONS     *";
    cout<<"\n\t\t\t\t\t\t\t*                              *";
    cout<<"\n\t\t\t\t\t\t\t********************************";
    cout<<"\n\n\t\t\t  __________________________________________________________________________________________________";
    cout<<"\n\t\t\t|                                                                                                    |";
    cout<<"\n\t\t\t|                                                                                                    |";
    cout<<"\n\t\t\t|       (1)  Age must be 18+.                                                                        |";
    cout<<"\n\t\t\t|       (2)  Damage for car/bike is your responsibility.                                             |";
    cout<<"\n\t\t\t|       (3)  You have to do 60% payment before we handover you car/bike.                             |";
    cout<<"\n\t\t\t|       (4)  You have return our car/bike on time otherwise we take extra charges.                   |";
    cout<<"\n\t\t\t|       (5)  Helmets are provided by our company.                                                    |";
    cout<<"\n\t\t\t|       (6)  You have to submit your valid license copy and some of the other documents.             |";
    cout<<"\n\t\t\t|       (7)  You should inform the company in advance if you intending to go another city.           |";
    cout<<"\n\t\t\t|       (8)  confirmed bookings are non-refundable.                                                  |";
    cout<<"\n\t\t\t|                                                                                                    |";
    cout<<"\n\t\t\t|                                                                                                    |";
    cout<<"\n\t\t\t  __________________________________________________________________________________________________";
    cout<<"\n\n\n\n\n\n\n\n\t\t\t\t\tPress... ANY KEY to go ahead >>>";
    getch();

    system("cls");
}

OUTPUT:








Post a Comment

Previous Post Next Post