Coder Social home page Coder Social logo

souravmondaldev / bus-reservation-system Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 6.0 223 KB

Bus Reservation System designed with c++

License: GNU General Public License v3.0

C++ 100.00%
bus-reservation cpp class-cpp function object-oriented-programming filehandling

bus-reservation-system's Introduction

Bus Reservation System


This is a simple Bus Reservation System programmed using Cpp .This program allows you to add bus details,then you can reserve a bus seat according to vacant seat available.One can check for list for vacant seats in a bus.It also allows you to see the available bus for now. This is a simple implementation of c++ code using class and structure.

How to run

Before running make sure you are having an c++ ide for windows users and g++ compiler installed for linux users.For windows user just open the file with any cpp ide and just compile and run.For unix users first navigate to the directory where this busrsm.cpp file stored and then run the follwoing commands in terminal.

g++ [filename.cpp]
./a.out # unix
a.exe # windows

Normal Input/Output format for the code:

souravmondal@sourav-pc:~/Documents$ g++ smBusRes.cpp
souravmondal@sourav-pc:~/Documents$ ./a.out
---------------------------------------------------------------------------
				****SM Bus Travel Agency****

---------------------------------------------------------------------------

***************************************************************************


			1.Add new Bus Details:
			2.Reserve your seats:
			3.Show the available seats in a bus:
			4.Buses Available Now: 
			5.Exit
***************************************************************************

			Enter your choice:-> 1
***************************************************************************
Enter bus no: 123

Enter Driver's name: Sam

Arrival time : 12:05AM

Departure: 12:20AM

From: 			HJK

To: 			LKI

***************************************************************************


			1.Add new Bus Details:
			2.Reserve your seats:
			3.Show the available seats in a bus:
			4.Buses Available Now: 
			5.Exit
***************************************************************************

			Enter your choice:-> 1
***************************************************************************
Enter bus no: 245

Enter Driver's name: Josh

Arrival time : 01:15PM

Departure: 01:30PM

From: 			KLO

To: 			PKL

***************************************************************************


			1.Add new Bus Details:
			2.Reserve your seats:
			3.Show the available seats in a bus:
			4.Buses Available Now: 
			5.Exit
***************************************************************************

			Enter your choice:-> 4
***************************************************************************
***************************************************************************
Bus no: 	123
Driver: 	Sam		Arrival time: 	12:05AM	Departure Time: 	12:20AM
From: 		HJK		To: 			LKI
***************************************************************************
___________________________________________________________________________
***************************************************************************
Bus no: 	245
Driver: 	Josh		Arrival time: 	01:15PM	Departure Time: 	01:30PM
From: 		KLO		To: 			PKL
***************************************************************************
___________________________________________________________________________

***************************************************************************


			1.Add new Bus Details:
			2.Reserve your seats:
			3.Show the available seats in a bus:
			4.Buses Available Now: 
			5.Exit
***************************************************************************

			Enter your choice:-> 3
***************************************************************************
Enter bus no: 123
***************************************************************************

Bus no: 	123
Driver: 	Sam		Arrival time: 	12:05AM	Departure time:12:20AM
From: 		HJK		To: 		LKI
***************************************************************************

    1.     Empty    2.     Empty    3.     Empty    4.     Empty
    5.     Empty    6.     Empty    7.     Empty    8.     Empty
    9.     Empty   10.     Empty   11.     Empty   12.     Empty
   13.     Empty   14.     Empty   15.     Empty   16.     Empty
   17.     Empty   18.     Empty   19.     Empty   20.     Empty
   21.     Empty   22.     Empty   23.     Empty   24.     Empty
   25.     Empty   26.     Empty   27.     Empty   28.     Empty
   29.     Empty   30.     Empty   31.     Empty   32.     Empty

There are 32 seats empty in Bus No: 123
***************************************************************************


			1.Add new Bus Details:
			2.Reserve your seats:
			3.Show the available seats in a bus:
			4.Buses Available Now: 
			5.Exit
***************************************************************************

			Enter your choice:-> 2
***************************************************************************
Bus no: 123

Seat Number: 36

There are only 32 seats available in this bus.
Seat Number: 32
Enter passanger's name: Mike

***************************************************************************


			1.Add new Bus Details:
			2.Reserve your seats:
			3.Show the available seats in a bus:
			4.Buses Available Now: 
			5.Exit
***************************************************************************

			Enter your choice:-> 3
***************************************************************************
Enter bus no: 123
***************************************************************************

Bus no: 	123
Driver: 	Sam		Arrival time: 	12:05AM	Departure time:12:20AM
From: 		HJK		To: 		LKI
***************************************************************************

    1.     Empty    2.     Empty    3.     Empty    4.     Empty
    5.     Empty    6.     Empty    7.     Empty    8.     Empty
    9.     Empty   10.     Empty   11.     Empty   12.     Empty
   13.     Empty   14.     Empty   15.     Empty   16.     Empty
   17.     Empty   18.     Empty   19.     Empty   20.     Empty
   21.     Empty   22.     Empty   23.     Empty   24.     Empty
   25.     Empty   26.     Empty   27.     Empty   28.     Empty
   29.     Empty   30.     Empty   31.     Empty   32.      Mike

There are 31 seats empty in Bus No: 123
The seat no 32 is reserved for Mike.
***************************************************************************


			1.Add new Bus Details:
			2.Reserve your seats:
			3.Show the available seats in a bus:
			4.Buses Available Now: 
			5.Exit
***************************************************************************

			Enter your choice:-> 5
***************************************************************************
Successfully Logged out from the Application. Visit Again!
<Thanks You :)>
Created By Sourav Mondal

Usage

  void addnewbus() # Used to add a new bus details

  void allotment(); #used to allot a set to an passenger

  void empty(); # to check if the buses are empty

  void show(); #shows avialble bus seats

  void avail(); #shows all avialable buses

  void position(int i); #to get the all reserved bus seats

Cons

file handling not added. A file system can make this block of code more reusable and complete. Any PR for file handling solution is appriciated ๐Ÿ˜Š.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate. Feel free to contact here: [email protected]

Credits

SouravMondal

bus-reservation-system's People

Contributors

ask2sm avatar avinitd avatar code4sm avatar souravmondaldev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bus-reservation-system's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.