Anda di halaman 1dari 19

Online Booking System-Client Server Technology

Course: Master of Science in IT(Multimedia Technology)

Participants

1>
2>
3>
4>

VENKATA SRIPAL REDDY NAREDDY


venae03@itu.dk
ASHOK KUMAR KANUKUNTLA
SRIDHAR

Table of Contents
1. Introduction

2. Background and Description of the the problem


3. System Requirements
4. Problem Analysis
4.1 Overview of the System
4.2 Client-Server Connection
4.3 Structure of Online Booking System
4.3.1 Sales Agent Module
4.3.2 Management Module
4.4 Database Design

5. Software Specifications
5.1 Requirements
5.2 Java
5.3 Servlets Overview
5.4 HTML
5.5 My SQL

6. User Guide and Examples


7. Technical Description of the Program
8. Testing
9. Conclusion
10.References
11. Appendix
11.1
11.2
11.3

Appendisx-A(Java Source Code)


Appendix-B(DATA FLOW DIAGRAMS)
Appendix-C(DataBase Tables)

1. PREFACE AND INTRODUCTION


The project has been carried out during a four-week project, from the 20th of
NOVEMBER to 19th of DECEMBER 2003 at the IT University of Copenhagen
under the guidance and supervision of Mr.Carsten Butz. We thank Mr. Carsten
Butz for assistance during the project.
We also thank the people who have given their support during the development of
the project.
During the mentioned timeframe we developed by using the Java programming
language, an Online MovieTicketBooking System . The computer network
environment that we work with in this project consists on a group of clients and a
server.

1.1Primary Goals
Build a Java environment for an online Booking System that supports clientserver Applications. The system is trained to reserve tickets for a movie.

1.2Limitations or Restrictions
The main limitation is the 4-week timeframe to develop this system. During this
time we have to find the tools that could be applied in order to find appropriate
solutions and make the system work.

Background and Description of the Problem


The main aim of this project is to book the movie tickets online. For this
purpose we have used java servlets and html forms to communication between
the client and server. The database we have used is MySql.
The main problem we have faced is checking the reservation status.when a
user comes to book a ticket for a particular movie, the system has to check
whether the seats are available for that movie in desired theatre on desired date.
To overcome this task we have designed database which is free from redundancy.
For this task we have created a table called Free_seats, in which we maintain the
movie name, theatre name, date and price categories.
For this task we have written a servlet called Booking Servlet, which
accepts the information from the user and sends it to the server, then the server
checks the database using the information provided by the user and sends a
response to the user.

Connecting to the database


Class.forName(org.gjt.mm.mysql.Driver).newInstance();
String username = cbgroup5;// Insert your own username for MySQL
String Password = h852s73j; // Insert your own password for MySQL.
String url = jdbc:mysql://mysql.it-c.dk/cbgroup5;
Connection con = DriverManger.getConnection(url, username, password);
Statement st =con.createStatement();
ResultSet rs=st.executeQuery(SELECT * FROM Free_seats);
ResultSetMetaData meta = rs.getMetaData();
int th_id=0;
int size1=0;
int size2=0;
String Time=null;
String theatrename=null;
String mvname=null;
while (rs.next())
{
theatrename=rs.getString("THNAME");
th_id=rs.getInt("TH_ID");
mvname=rs.getString("MOVNAME");
size1=rs.getInt("C1_SIZE");
size2=rs.getInt("C2_SIZE");
String dt=rs.getString("MDATE");
Time=rs.getString("SHOWTIME");
}
The program checks the seats available to the movie requested, and
process the task. If not there is a possibility of throwing errors. To avoid such
errors, the system checks the condition whether the no. Of tickets requested are
less than the available seats. If the condition is true the system reserves the
requested no. Of tickets to the user. If the Condition is flase it displays a message
with the available no. Of seats and request the user to enter the no. Of seats that
are available.

SYSTEM REQUIREMENTS
The sytem should consist of client-server application. Both the client and
server part of the applicatiopn should be written in java.
The system has to provide a user to search movies that are running in the city and
allow him to serve tickets for a movie, eg. A user sends his request to book a ticket for a
movie to the server, and the server checks the availability of the tickets for the requested
movie and allots him a Reservation ID as a response from the server.
The Client side might be included in respect to capturing the requests from the
user and transmitting them over the network. The client side should include a simple
graphical user interface, which provides capabilities of capturing and transmitting
requests over the network.
The server side should receive the requests, carry out task of booking a ticket for
the requested movie and send back to the client the result .

Problem Analysis
Overview of the System
The system was built based on the Java code that was provided and
tested during the Client-Server course exercises.
The system has a Client side and Server Side. The Client side is
used to capture the requests(booking a ticket for a movie) from the user,
and transmit the data over the network. The Server Side is used to receive
the data from the client and carry out the reservation task.

Client-Server Connection
A network connection between users and a server is made through
sockets. Normally the server runs on a specific computer and has a socket
for communication and listens on a specific port. It basically waits and
listens until a client requests a connection(see Figure 0-1 Client-Server
Connection A).

The client should know the hostname of the computer on which the
server is running and also the port number to which the server is
connected.
If the server accepts the connection request from the client, the
server makes a new socket with a different port and communicates with
the client from there. Then the port on the server that waits and listens is
available again and ready to receive new connection requests from other
client(s) an at the same time attending the needs of the connected client.

Structure of the Online Booking System


The design of the project was developed based on the previously
described Requirements Specification and problem Analysis using javaprogramming language. In order to create a communication network, two
main classes were created: the Client and the Server class. The description
of the program will be divided into two parts, the first referring to the
Client side and the other referring to the Server side. In this project we
have divided into two modules one is sales agents module and the other
being the management module.

Sales Agents Module


The main task of the system is to book the tickets online through
sales agents for a particular movie in a particular theatre of user choice.
The Sales Agents book the tickets online according to the user
requirements.
In this module a sales agent searches for a movie .and book a ticket
for a movie in a particular theatre using the user interfaces that are
developed. Not only booking tickets but also cancellation of tickets can
also be done using this system. The system can only gives access to the
authorised users.Every agent has its own login.. When a sales agent login
to the system he has to provide his username and password .whenever he
provides the correct login he can view the complete movie information
containing the movie name, theatre name, no of tickets available are
displayed. Then the agent can book the tickets by providing the
reservation details in the reservation form that are collected from the user..
As soon as the agent submits the reservation details the system reserves
the desired no. Of tickets and provides the user a Reservation ID. If the no.
of requested tickets is greater than the no. Of free seats then the system
displays a message available no. Of free seats.

If a user wish to cancel his reservation, he can do so by submitting


his reservation Id. As soon as he submits his res_id, and the number of
tickets he wants to cancel the system will do the appropriate operation and
updates the no. of free seats in the Free_seats table.
We have maintained two levels of prices for each theatre. This
price differs on based on the movie.

MANAGEMENT MODULE
This module is meant for management. In this module
management people can create new agents, update movie information,
insert movies into the database and can updates the databse. Using the
management interfaces that are developed can do this whole process .
Management people dont interact directly with the database, but using the
interfaces they can modify, insert, update and delete the information from
the database.
This module is restricted for only one user for security reasons.
Only the authorized person can access this module. He can only login into
this module by providing valid username and password. As soon as he
login to this module, he has options like insert, update,delete, and create.
Using these forms he makes changes into the database. The forms
developed are most user-friendly.

Database Design:
We have used MySQL database to design our tables. In our project we
have used four tables for our need. (Refer Database Tables in Appendix)

Tables:
Agent_Info
Th_Info
Mov_Info
Res_Info
Free_seats

Agent_Info
agent_id
agent_name
Username
Password

Address
Phoneno
This table maintains the details of the sales agents. Here every
agent is given an ID, which is unique .

Mov__Info
MOV_ID
MOVNAME
THNAME
DATE
This table maintains the complete info about the movies. Every movie has
a unique and Id, which is a primary key.

Res_Info
RES_ID
THNAME
MOVNAME
MDATE
NO_TICKETS
PRICE
This table maintains the details of the reserved tickets.
Reservation Ids will generates randomly and stores into the database. Here
RES_ID is unique. This Id is used as a reference.

Free_ Seats
THNAME
MOVNAME
C1_SIZE
C2_SIZE
MDATE
This table maintains the complete details of the available seats for
each movie. C1_SIZE and C2_SIZE are the number of seats of both
class1and class2 respectively.

Software Specifications
Requirements:
. Java Servlets
. My SQL Database
. HTML

Java
Java is an object oriented programming language. It is simple to
understand as it is make possible to model real life objects in digital
environment by using java classes, give the description to eht objects by
using variables and give functionality to the objects by methods.
Java was designed as an Internet-application language and allows
writing programs as Java applications or Java applets. For this project we
used J2SE that supports server side programming to cary out the task of
reserving tickets for a movie.

Servlets Overview
. Servlets are Java technologys answer to CGI programming. They
are programs that run on a Web server and build Web pages.The necessity
of creating the webpages dynamically leads to invent the servlet
technology.Java servlets are more efficient, easier to use, more powerful,
more portable, and cheaper than traditional CGI and than many alternative
CGI-like technologies.

HTTP Request Headers:


When an HTTP client(e.g. a browser) sends a request, it is required
to supply a request line (usually GET or POST). If it wants to, it can also

send a number of headers, all of which are optional except for ContentLength, which is required only for POST requests.
HTTP Response Headers:
A response from a Web server normally consists of a status line,
one or more response headers, a blank line, and the document. Setting the
HTTP response headers often goes hand in hand with setting the status
codes in the status line.

Handling form Data


One of the nice features of Java servlets is that all of this form
parsing is handled automatically. Just simply call the get Parameter
method of the HTTP Servlet Request, supplying the parameter name as an
argument. This is exactly the same way when the data is sent via GET as
we do when it is sent via POST. The return value is a String corresponding
the undecoded value of the first occurrence of that parameter name. An
empty String is returned if the parameter exists but has no value, and null
is returned if there was no such parameter. If the parameter could
potentially have more than one value we should call get Parameter Values
instead of getParameter. This returns an array of strings.

HTML
HyperText Markup Language(HTML), the publishing language of
the World Wide Web. In addition to the text, multimedia, and hyperlink
features it also supports more multimedia options, scripting languages,
style sheets, better printing facilities, and documents that are more
accessible to users with disabilities. HTML takes great strides towards the
internationalization of documents, with the goal of making the Web truly
World Wide.

MySQL
The MySQL database is a high-performance relational database
management system for Web site and business application development
and deployment. With a streamlined but functionally-rich feature set, the
MySQL database maximizes speed, stability and ease of deployment.
MySQL is available on all major Linux distributions, as well as Unix, Mac
OS and Windows operating systems. The optimization of MySQL for the

Amd Opteron processor further extends the reach of MySQLs database


solution.
The MySQL database server is the worlds most popular open
source database. Its architecture makes it extremely fast and easy to
customize. Extensive reuse of code within the software and a minimalistic
approach to producing functionally rich features has resulted in a database
management system unmatched in speed, compactness stability and ease
of deployment. The unique separation of the core server from the storage
engine makes it possible to run with strict transaction control or with ultafast transactionless disk access, whichevery is most appropriate for the
situation.

Users Guide and Examples


Main page
This is a home page of Online Booking System. This page contains
some graphical images and the images of the movies currently showing in
the theates. This page consists of a menu, which have link to several other
pages like About the System, Movies Info, Terms & Conditions, Cancel
Reservation. This page also consists of Search option and Sign In.

Search by Movie:
If the user wants to search for a particular movie , he has to submit
the moviename, and clicks on the GO button he gets the information of the
requested movie or theatre.

Sign In:
If the user clicks on this link he is redirected to login page.

Login Page
This page used to login into the system for both the Sales Agents
And Management. A registered user can sign into the system by providing
valid username and password. If the user enters incorrect username or
password he is requested to provide a valid username and password.
If the agent is successfully logged in, he is redirected to Reservation form.

Reservation Form
This page contains the staus of reservations of each movie. Here
the agent can see the status of each movie and reserve the ticket for the
requested movie by submitting theatrename, moviename, date, no.of
tickets and price. As soon as he submits the above values the user gets a
Res_Id, which is randomly generated by the system.

Cancelation Page
This page is meant for canceling the reservations. Here the sales
agent has to submit the reservation id and the number of tickets he wants
to cancel.

Management Updation Page


As soon as the management people login to the system they are
redirected to this page. In this page complete movie information of all the
theatres are displayed. Here the management can insert a new movie into
the database or delete a selected movie from the list.

Management Insert Page


When the management people clicks on insert button this page is
displayed Here they are asked to procide the theatre name, movie name
and date, submits the above values they get the updated version of
Management Updation Page.

Technical Description of the Program


The online booking system consists of two modules one the
client side, the sales agent module and other the Server side i.e
Management module, In the sales agent module we have the
following 5 classes. (Refer UML Diagrams in Appendix)

Classes Used In Agent Module


. Class login servlet
. Class Booking Servlet
. Class Cancelation Servlet
. Class MovieSearch Servlet
. Class ReservationInfo Servlet
In the management module we have the following 3 classes
(refer UNL Diagrams in Appendix)

Classes Used In Management Module


. Class ManagementInfoServlet .
. Class Management Insert
. Class Delete Servlet

Sales Agent Module Main Classes:


Login Servlet:
This Servlet is used to allow the authorized agents
to access the system. Only one method is used in this Servlet.
Public void doGet():
When an agent submits his username and password
this method is invoked. When a user clicks on submit button this
method checks the username and password supplied by the user
and checks the submitted values with the Agent_Info table. If the
values are matched, the agent is allowed to enter into the system
and carry out the required tasks. (source code in Appendix)

If(funame.equalsIgnoreCase(uname)&&fpwd.equalsIgnore
Case(pwd))
{
response.sendRedirect(http://loclhost:8080/user/venae03/servlet/M
oviesInfoServlet)
I++
}
elseif(funame.equalsIgnoreCase(username1)&&fpwd.equal
sIgnoreCase(passwprd1)){
response.sendRedirect(http://ip59:8080/upendegila/servlet
/ManagementInsert);
I++
}

Booking Servlet:
This servlet gives the information about the
reservation status of all the movies. This information is retrieved
from the Free_seats table. If the customer wants to book a seat for
a particular movie, the sales agent enters the Movie name, Date
Number Of Tickets, and Price Category.

ReservationInfoServlet
When the sales agent press the button Submit in the
Booking Servlet this Servlet will be invoked and takes the values
from the User and Inserts into the reservationinfo table and updates
the free_seats table, and gives the reservation id to the customer
and how much price the customer has to pay.

MovieSearchServlet:
This Servlet is used to search movies . It accepts movie
name from the user and searches the Free_seats table and displays
the results.

Management Module Main Classes


Management Info Servlet
whenever the management logs into the system, this
Servlet is invoked and displays the currently showing movies
information. This Servlet gives two options i.e., insert a movie and
delete a movie. Based on the action he has selected that particular
Servlet is invoked. (source code in Appendix).

ManagementInsert
This Servlet is called when the management want to insert
a movie into the database. It accepts the movie name, date and
theatrename. These values are inserted into Mov_Info table and
updates the Free_seats table. (source code in Appendix).

Delete Servlet:
This Servlet is invoked when the management people
selects a movie and press the delete button. This action performs
deleting the selected movie information from the Mov_info and
Free_seats tables(source code in Appendix).

Test
Test results
We tested our system on specific scenarios and found that it
handles standard situation. we should be also mention that the
system is not capable to handle unexpected use.
Based on the testing results, we found that changes and
improvements can be made to provide more stability to the system.
. Handling exceptions and creating a specific exceptions
. Use conditions to handle unexpected use of the program

Further Improvements and Extensions of the System

1> Seating Arrangement can be made based on user choice


2>This system can be extended to any number of theatres and shows.

Conclusion

Achievements

During this four-week project we developed a program that


functions according to the system requirements, we developed a
simple online booking system in a java environment.
During this project we utilized not only java programming
skills but also a theoretical knowledge of the system we developed.
Our practical achievement is basically an extensive
experience in java programming. In addition to that we learned to
use algrothim and programs developed in java environment.

Scope:
This project covers all the agents.
This system can extended to any number of agents and
maintenance center
This is very useful for easy maintenance.

Refrences

The complete reference HTML(Second Year)-By Thomos


A.Powell
Year & Publications: 1999 by the McGraw-Hill
Companies
Programming with Servlets & JSP Technology-By
Rockvillle Maryland Year & publications: 2003 June by Johns
Holkins University Montigomary County Center
The gurs Guide the Transact-SQL By Ken Handersen.
Year & Publications: 2001 by Addison-Wesly.

Websites Referred:
www.sun.java.com
http://www.htmlhelp.com/reference/html40/olist.html

Anda mungkin juga menyukai