csc186 Group Project Report Bus Reservation System
csc186 Group Project Report Bus Reservation System
Group : JCS1102A
TABLE OF CONTENT
NO TOPICS PAGE
1 ORGANIZATIONAL STRUCTURE 3
2 PROJECT TITLE 4
3 INTRODUCTION 4
4 OBJECTIVES 5
5 LIST OF PROCESSINGS/OBJECTIVES 5
6
6 UML DIAGRAM
7
7 USE CASE DIAGRAM
8
8 INPUT DATA
9 - 21
9 CLASS DEFINITION OF INHERITANCE AND POLYMORPHISM
22 – 25
10 INFORMATIONS DISPLAY AND INTERFACE SAMPLES
26
11 REFERENCES
ORGANIZATIONAL STRUCTURE
1. Project Title:
Bus Ticket Reservation
2. Introduction:
Ticket Nation is one of the new projects that had been assigned to provide the reservation
bus ticket platform for people or traveler who want to travel all over Malaysia. The platform
enables traveler to reserve and order the ticket to make sure traveler will have the best
travel experience in their life. This system will provide user to choose the destination that
they want to go as they can arrive at the right place at the exact time.
To make sure the system will provide what the customer wants, they will need to
provide their name, age, phone number and the quantity of ticket. By fulfill all this
requirement, this system will give customer the ticket to make sure they will have
permission to have a bus service to make sure they can go travel to the destination that
they want and arrive safely without any problem or issues. As stated in the UML Diagram
on page 6 in this proposal as the information needed in the development of Ticket Nation
bus ticket reservation system. The following class Customer defines all the details required
for the user information while class Ticket will define all the details for the ticket info for
customer. The system will be able to count number of tickets for each destination,
determine the maximum and minimum number of ticket that customer have bought,
calculate average ticket price, and calculate the total price of tickets. Besides that,
discount also provided for customer which are count by their age which is children will
enjoy 20% discount while elder will entitled 25% discount.
In the end of the system, it will display all the user information that user had enter.
So, user will know that the transaction that they have made was successful. The final
receipt will show the final price, customer’s detail, and the bus route.
3. Lists of Processing/Objectives:
i. Count the number of tickets for different destinations that the customers decided to go.
ii. Count the maximum and minimum number of tickets the customers bought.
iii. Calculate the average of ticket's price for all customers.
iv. Calculate the price of the tickets for different destinations with discount and without
discount:
- Children: 20%
- Elder: 25%
v. Calculate total price of tickets for all customers.
vi. Search customer's name and update customer's information.
vii. Sort the customers based on the quantity of tickets in ascending order.
UML DIAGRAM
INPUT DATA
For input, we use txt file as there are many customer’s input to be insert in our system.
We use bufferedReader and StringTokenizer for reading txt file.
We also use a JOptionPane for user to search customer’s name to make sure they are in our
system.
CLASS CUSTOMER
CLASS TICKET
public abstract class Ticket
{
protected int quantity;
protected Customer customer;
protected String destination;
10
CLASS LOCAL
import java.text.DecimalFormat;
public class Local extends Ticket
{
private String insurance;
DecimalFormat df = new DecimalFormat("0.00");
11
else
insuredCharge = charge;
return total;
}
12
CLASS ISLAND
import java.text.DecimalFormat;
public class Island extends Ticket
{
private boolean membership;
DecimalFormat df = new DecimalFormat("0.00");
//accessor
public boolean getMembership()
{
return membership;
}
13
return member;
}
14
import java.io.*;
import java.util.*;
import javax.swing.JOptionPane;
import java.text.DecimalFormat;
public class BusReservation
{
public static void main(String[] args) throws IOException
{
try
{
DecimalFormat df = new DecimalFormat("0.00");
DecimalFormat dt = new DecimalFormat("0.00");
String line;
Ticket [] t = new Ticket[100];
int [] array = new int[100];
int i = 0;
while((line = br.readLine())!=null)
{
StringTokenizer st = new StringTokenizer(line,",");
String choice = st.nextToken();
String cName = st.nextToken();
int cAge = Integer.parseInt(st.nextToken());
String cPhone = st.nextToken();
15
16
17
//search customer
18
19
array[x] = array[x+1];
array[x+1] = swap;
}
}
}
System.out.println("\n
LIST OF ALL CUSTOMERS [AFTER SORTING]
");
System.out.println("--------------------------------------
----------------------------------------------------------------------
-----------");
for(int c=0;c<n;c++)
{
if(c==0)
{
for(int j=0;j<n;j++)
{
if(array[c] == t[j].getQuantity())
System.out.println(t[j].toString());
}
}
else if(array[c] != array[c-1])
{
for(int j=0;j<n;j++)
{
if(array[c] == t[j].getQuantity())
System.out.println(t[j].toString());
}
}
}
20
System.out.println("--------------------------------------
----------------------------------------------------------------------
-----------");
pw.close();
br.close();
}
catch(FileNotFoundException e){System.out.println("File
cannot be found!");}
21
Diagram below shows an output sample that using FileWriter and BufferedWriter method.
Diagram below shows a pop out that using JOptionPane for management to fill in the
customer’s name to search customer’s name if their name is in the system or not.
This is the output if customer’s name was found and it will updated the customer’s name and
phone number.
22
While this is the output if customer’s name does not exist in the system
This is the output sample that had been sorting in ascending order with a total count of ticket
reservation
23
24
In the end of program, it is show that the total ticket bought by all customers which are 54
tickets. All the sequence in the diagram is sorted by the quantity of tickets which is sort in
ascending order
25
REFERENCES
26