Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Assignment Brief Academic Year 2019-20

Module Data Structures & Module


code and Guy Walker
Algorithms leader:
title:
Assignment Assessment
CW 1 100%
No. and type: weighting:

Submission time Target feedback


22/12/2019 Submission Date + 3 Wks
and date: time and date:

Name : Hewage Dinusha Roshan Ranatunga


University ID : 21908549
Fit to Submit: Assignment Checklist

This brief assignment checklist is designed to help you avoid some of the most common
mistakes students make in their coursework.
HAVEYOUREADTHE SSIGNMENT BRIEF?
IF NOT, DO IT NOW!
Inityou will find details of the assessment task, word count, the assessment criteria your work is marked
against ,and the learning outcomes– the basis for the assessment strategy in each module.

Studentsoftenlosemarksbyforgettingsomeofthemorestraightforwardelementsof their assignments.


We recommend that you “tickoff” each of the points below as you prepare your work for
submission. If you need any help, ask your tutor and / or visit
https://bucks.ac.uk/students/academicadvice/assessment- and-examination

TICK
 Have you read and understood the assessment criteria?

 Have you met the learning outcomes? You will lose marks and your work
may even be failed if you have not.
 Have you checked that the USB memory stick being submitted is working and
has all necessary files saved to it?
 Have you demonstrated you can think and write critically in the completed
work? This means you have supported your arguments/explanations
appropriately e.g. using relevant academic sources and you have offered
discussion points which extends your own or others’ viewpoints to make
reasoned conclusions/ judgements.
 Have you maintained an academic tone throughout your work? Is your
work formal, focused, developed and clear?
 Have you checked that the referencing in your assignment is in line
with your programme requirements?
 Have you proof-read your work and used spell check software to check
your spelling and grammar?
 Have you kept to the word count (or equivalent)? If you are not sure, check
with your tutor.
 Can you confirm that the work submitted is your own and not plagiarised?
Acknowledgement
I would like to thank my parents first and foremost. They have given their fullest corporation
to finish this assignment. Directress of my company, Ms Pathmaseeli, she gave valuable
guidance and advice throughout the assignment. In addition, she allowed working leaves for
me for extra studying and complete my assignment. She inspired me greatly to work in this
assignment and project.

Besides, we would like to thank bus drivers and conductors, who work in bus route numbers
100 and 87 for providing me bus environment situation, issues of bus ticket bookings etc.
Finally, an honorable mention goes to friends for their supports to complete this project.
Without above mentioned people’ helps, I would face lot of difficulties while doing assignment
and project.
Table of contents

1. Proposed System .......................................................................................................... 01-02


1.1 Introduction ...............................................................................................................01
1.2 Current system issues .......................................................................................... 01-02

2. Data Structures ..................................................................................................................03


2.1 What is the data structure ...........................................................................................03
2.2 Data structures available in software programming ...................................................03
2.3 Why I have selected C++ for implementation of system? .........................................03

3. UML Diagrams............................................................................................................. 04-08


3.1 Flowchart diagram ......................................................................................................04
3.2 Entity relationship diagram ........................................................................................05
3.3 Class diagram .............................................................................................................06
3.4 Activity diagram .........................................................................................................07
3.5 Use case diagram ........................................................................................................08

4. Codes & Screen Shots .................................................................................................. 09-15


4.1 Inserting of bus details ......................................................................................... 09-10
4.2 Booking a seat by passenger ................................................................................ 10-11
4.3 When passenger try to book a over the 20th seat ........................................................12
4.4 When passenger try to book a not available seat (not vacant) ...................................12
4.5 Checking of available seats in a bus ..................................................................... 13-14
4.6 Available buses list .....................................................................................................15

5. Evaluation ...........................................................................................................................16
5.1 Evaluation and strengths of the system ......................................................................16
5.2 Weaknesses of the system ..........................................................................................16
5.3 Future development opportunities ..............................................................................16

6. Conclusion ..........................................................................................................................17
1. Proposed system
1.1 Introduction
Intercity bus ticket booking system has been one of the main
concerns in Central Colombo, Sri Lanka. This will be a growing
demand as well as a new trend in moving to online intercity bus ticket
booking systems. According to introducing this system, passenger’s
self-interaction in ticket booking will be changed in a positive way.
However, Central Colombo Point (CCP) is the busiest place in Sri
Lanka. All bus routes, covering every districts have been linked from
here. Usually, more than five hundred (500) journeys will be started
from here per day and nearly a hundred thousand (100,000) passenger will be travelled across
this point.

When buses arrived at the CCP, then all buses to be entered into the system. Bus
number, bus route, starting time, destination, destination time and ticket fee to be inserted. All
intercity buses are 20 seated passenger buses. Located of seats structure will be displayed front
of ticket center, hence passenger easy to book their preferred seat without any hesitation.

1.2 Issues of the current situation

Nowadays manual tickets or digital ticketing issuing equipment are being used by the
transportation sector. Specially digital ticket issuing equipment will be popular among the
intercity buses. Only a few data could be stored in digital machines. Some of them are the
amount of cash collected for each trip, the number of issued tickets. Tickets issuing to be done
only for cash. As commonly not difficult to issue fake intercity bus tickets. Passengers won’t
be received a balance bus fare from conductors.

Earlier, complains have been received from passengers and bus owners regarding bus
ticket issues. Available buses couldn’t have been seen by passenger, different ticket prices have
been charged by bus conductors, conductors haven’t responded the ticket issues, arguments
between passengers and bus conductors have been seen frequently, available bus seats couldn’t
be checked by bus conductors, starting time and destination time have been decided by bus
drivers and conductors as their convenience and profit. If the not satisfied amount of passengers

1|Page
inside the bus, they have taken extra time to start the bus. If bus drivers want to run an extra
journey, they would have tried to complete the journey prior to destination time.

At daytime, intercity buses can be seen on roads once in 10 minutes running to every
area of Sri Lanka. During working hours, specially morning 8am – 9am and 5pm – 7pm
intercity buses will be run once two minutes, sometime two or three buses will be started at the
same time. Every driver is preferred to drive during that period. Hence, arguments will be
begun among drivers. But at night period, it will be changed totally. Passengers are on roads
and waiting for buses. But buses won’t be seen for a long time, sometimes passengers had to
wait more than two hours until the bus arrives at the bus point. Specially buses not work at
mid-night because only a few passengers are there. Bus owners not much like to run their buses
at mid-night considering profit.

Parking space available for only hundred buses at a time. Cause of this point lot of buses
will have to park outside of parking place. Some buses are parked on main roads some are
returned to their home. When they park on roads illegally, they will have to pay fines.

2|Page
2. Data Structure
2.1 What is the data structure?
Data structure will be used to turn abstract data into a specialized format such as
organizing, processing, retrieving and storing data. There are several data structure types, some
are basic types and some are advanced types, which will be devised to solve complex hard
search problems.

2.2 Data Structures available in Software Programmes


Nowadays, few of software programmes are used by programmers for implantation of
data structures. Some of the popular software programmes are Python and Ruby, C, C++, Java,
C#, Haskell etc.

2.3 Why I have selected C++ for implementation of system?


C++ will be one of the highly portable languages. C++ will be an object-oriented
programming language. Classes, inheritance, polymorphism, data abstraction and
encapsulation will be easily implemented and maintained. And codes also will be reused
without errors. The supposed system will be a low-level programme, hence C++ is useful and
efficient for this and it is an object-oriented programme. C++ code will be checked prior it is
executed, compared with other dynamically written languages. And it’s compatible with C
language.

3|Page
3. UML Diagrams

3.1 Flowchart diagram for “intercity bus ticket booking” system.

4|Page
3.2 Entity relationship diagram for “intercity bus ticket booking” system.

5|Page
3.3. Class diagram for “intercity bus ticket booking” system.

6|Page
3.4 Activity diagram for “intercity bus tickets booking” system.

7|Page
3.5 Use case diagram for “intercity bus tickets booking” system.

8|Page
4. CODING & SCREEN SHOTS
4.1 Inserting of bus details
When bus arrived to “intercity bus station”, following details of bus to be entered to system.

ENTER BUS NUMBER


ENTER ROUTE NUMBER
ENTER DRIVER'S NAME
START TIME
DESTINATION
DESTINATION TIME
TICKET FEE

Code
// Entering bus details
void ticketbooking::Insert()
{
cout << "\n\t\t\t ENTER BUS NUMBER : \t";
cin >> bus[p].busNo;

cout << "\n\t\t\t ENTER ROUTE NUMBER : \t";


cin >> bus[p].routeNo;

cout << "\n\t\t\t ENTER DRIVER'S NAME : \t";


cin >> bus[p].driverName;

cout << "\n\t\t\t START FROM : \t"; cout << "COLOMBO \n";

cout << "\n\t\t\t START TIME : \t";


cin >> bus[p].startTime;

cout << "\n\t\t\t DESTINATION : \t";


cin >> bus[p].to;

cout << "\n\t\t\t DESTINATION TIME : ";


cin >> bus[p].destinationTime;

cout << "\n\t\t\t TICKET FEE: RS.";


cin >> bus[p].ticketprice;

cout << "\n\t\t\t successfully recorded";


bus[p].empty();
p++;
}

9|Page
Visual Studio C++ console

4.2 Booking a seat by passenger


When passenger arrived to “intercity bus station”, following details to be given for booking a
seat.
ENTER BUS NUMBER 2310 Ticket fare will be
TICKET FARE 1750 appeared according to the
given bus number.
SEAT NUMBER 14

PASSENGER'S NAME J.ROOT

Code
void ticketbooking::booking()
{
int seat;
char number[10];

top:
cout << "\n\t\t\t ENTER BUS NUMBER: ";

10 | P a g e
cin >> number;

int n;
for (n = 0; n <= p; n++)

{
if (strcmp(bus[n].busNo, number) == 0)
break;
}
// Bus ticket fare will be displayed according to the bus number
cout << "\n\t\t\t TICKET FARE : " << bus[n].ticketprice << endl;
while (n <= p)
{
cout << "\n\t\t\t SEAT NUMBER: ";
cin >> seat;

if (seat>20)
{
cout << "\n\t\t\t Sorry! There are only 20 seats available in
this bus. ";
}
else
{
if (strcmp(bus[n].seat[seat / 4][(seat % 4) - 1], "-") == 0)
{
//passenger name to be entered
cout << "\n\t\t\t PASSENGER'S NAME: ";
cin >> bus[n].seat[seat / 4][(seat % 4) - 1];
break;
}
else
cout << "\n\t\t\t Sorry! This seat has been reserved by a
passenger";
}
}
if (n>p)
{
cout << "\n\t\t\t Sorry! This is not valid Bus Number\n";
goto top;
}
}

Visual Studio C++ console

11 | P a g e
4.3 When passenger try to book a over the 20th seat

ENTER BUS NUMBER 2310


TICKET FARE 1750
Sorry! There are only 20 seats
SEAT NUMBER 23 available in this bus

Visual Studio C++ console

4.4 When passenger try to book a not available seat (not vacant).

ENTER BUS NUMBER 2310


TICKET FARE 1750
Sorry! This seat has been reserved
SEAT NUMBER 14 by a passenger

Visual Studio C++ console

12 | P a g e
4.5 Checking of available seats in a bus

ENTER BUS NUMBER 2310

Code
//Checking of available seats in a bus
void ticketbooking::display()
{
int n;
char number[5];
cout << "\n\t\t\t ENTER BUS NUMBER: ";
cin >> number;

for (n = 0; n <= p; n++)


{
if (strcmp(bus[n].busNo, number) == 0)
break;
}
while (n <= p)
{

cout <<
"\n\t\t\t************************************************************************\n";
cout << "\n \t\t\t BUS NUMBER : \t" << bus[n].busNo
<< "\t\t ROUTE NUMBER : \t" << bus[n].routeNo << "\n"
<< "\n\t\t\t BUS START TIME :" << bus[n].startTime << "\t\t Bus
Destination Time :" << bus[n].destinationTime
<< "\n \t\t\t FROM: \t\t" << "COLOMBO" << "\t\t To: \t\t"
<<bus[n].to << "\n";

cout <<
"\n\t\t\t************************************************************************\n";
bus[0].position(n);
int ticketbooking = 1;
for (int i = 0; i<5; i++)
{
for (int j = 0; j<4; j++)
{
ticketbooking++;
if (strcmp(bus[n].seat[i][j], "-") != 0)
cout << "\n \t\t\t SEAT NUMBER " << (ticketbooking
- 1) << " FOR " << bus[n].seat[i][j] << ".";
}
}
break;
}
if (n>p)
cout << " t\t\t Sorry! This is Not valid Bus Number ";
}

void ticketbooking::position(int l)
{
int s = 0; p = 0;
for (int i = 0; i<5; i++)
{
cout << "\n \t\t\t";
for (int j = 0; j<4; j++)

13 | P a g e
{
s++;
if (strcmp(bus[l].seat[i][j], "-") == 0)
{
cout.width(5);
cout.fill(' ');
cout << s << ".";
cout.width(10);
cout.fill(' ');
cout << bus[l].seat[i][j];
p++;
}
else
{

cout.width(5);
cout.fill(' ');
cout << s << ".";
cout.width(10);
cout.fill(' ');
cout << bus[l].seat[i][j];
}
}
}
cout << "\n\n\t\t\t NUMBER OF AVAILABLE SEATS " <<p;
}

Visual Studio C++ console

14 | P a g e
4.6 Available buses list

[4] BUSES LIST


SELECT YOUR CHOICE 4

Code
//Available buses list
void ticketbooking:: availableBuses()
{
cout << "\n\t\t\t****************************************************\n";
cout << "\t\t\t\t BUSES LIST \n";
cout << "\n\t\t\t****************************************************\n";
for (int n = 0; n<p; n++)
{
cout << "\n BUS ROUTE NO: \t" << bus[n].routeNo;
cout << "\n BUS NO: \t" << bus[n].busNo<<"\t\t TICKET FARE :
RS."<<bus[n].ticketprice;
cout << "\n FROM:\t COLOMBO" << "\t\t START TIME :" << bus[n].startTime
<< "\t\t To: "<<bus[n].to << "\t\t DESTINATION TIME :" <<
bus[n].destinationTime<<endl;
cout<<"-------------------------------------------------------------\n";
}
}

Visual studio C++ console

15 | P a g e
5. Evaluation
5.1 Evaluation and strengths of the system
As the proposed system, the several critical issues of facing both passengers and bus
owners will be solved. All intercity buses will be registered to system and bus owners will be
received details of their routes and starting time once a week. They should have come at least
before 20 minutes to Colombo Central Point. Every 10 minutes new bus group will have arrived
at the parking venue as a limitation of 100 buses. Hence bus drivers will haven’t suffer from
parking issues, no fines.

Every bus tickets will be issued by CCP. Hence, bus conductors won’t be waste their
time. Passengers could have buy tickets meanwhile their leisure times even they can use credit
cards for payment. As well as passengers have the ability to book their preferred seat numbers.
Tickets issues, seat booking issues, arguments between bus conductors and passengers won’t
have happened.

Every journey has starting time and destination time (approx.) however it won’t be
broken by bus drivers without any considerable reasons, otherwise, bus drivers will have to
pay fines. It avoids very late destination, it would be good for passengers to end their journey
without any delay.

5.2 Weaknesses of the system


There are a few weaknesses in the system. The main issue of the proposed system, it
won’t be activated for online ticket bookings. Any passenger would be happy to book his/her
ticket through online, hence passengers should have come to CCP for booking tickets. Tickets
cancellation and modify the booking date haven’t been implemented in the system.

5.3 Future development opportunities


As I identified, modification of system such as interface, presentations, flow of system which
are to be corrected soon. It should have developed according to the latest interface and
functions. However, it should be converted to a web-based system, then passenger will have
the ability to booking online tickets. Meanwhile, ticket cancellation, refund money and
modification of booking dates should be added to the system.

16 | P a g e
6. Conclusion
According to the given scenario, intercity bus ticket booking system has been implemented
using the C++ language. Several data structures types have been used for the implementation
of this system, which l learned under the data structures and algorithm subject. This system can
be prevented from several issues, which is having an existing system as described under the
1.2 current system issues. System implementation and its usage have been explained using
screenshots and coding under main number 4. Codes & screenshots.

17 | P a g e

You might also like