Bolton Institute, UK – B.Sc. (Hons) Computing
Assignment- Web and Systems Based Programming  (Java Programming)
Systematic Kuching

Title: Concert Seat Booking Program
Author By: Eric Kon Yin Liang
E-mail: [email protected]

Student number:0221213


Source Code
 
Online Source Code
Question 1: SeatClient. java
 
Question 2: SeatServer. java
 
Reset Seat Status: Reset. java
 
   
Basis classes supplied by Bolton
 
ConcertSeat. java  
Concert. java  
Block. java  
   
   
or Download Source Code
SourceCode. zip
 
 

JavaDoc Compliant documentation- Click Here
 

Operating instructions
 
To operate this Concert Seat Booking Program, you need install j2sdk1.4.0. on computer. After install JDK version 1.4, copy all 6 java file that have been provided into text editor like Notepad or Edit, each java file name must be save same as the name of the public class defined in the .java file and in same folder. The source code file also can be download if u want.
 
Now use the javac compiler converts each java source code into java byte codes, which can be executed by java. entering following at the shell prompt javac SeatServer. java Screen Shot .
 
After compiling all the source code, Reset.java must run first before start the server, this is use to create test.txt file which is use to store the data, and it also use to reset all the seat status thats have been saved.
 
Now you can run this Concert Seat Booking Program with java interpreter by entering the following command:  java SeatServer Screen Shot, after server have been start, run following command for client GUI part :  java SeatClient Eric Screen Shot . when 'Welcome to Concert Seat Reservation System!' message appear at client terminal, that mean connection are success between client and server else client terminal will receive 'Fail Connect to Server' Screen Shot.
 
While operator with the name Eric press a button to reserve 1A seat, this will send a message to server confirming or refusing the request, to accept the Eric request type 'y' at server and the Eric GUI window 1A seat button color will be update to green and price value also will get display at client terminal Screen Shot. if this massage appear ' Free Seat 1A Rejected' at client terminal, this mean client get rejected by server Screen Shot . The allocate button at GUI is use to change the all reserve seat (green color)  to red color Screen Shot .
 
Concert Seat Booking Program also able support multiple client operate on single concert. which means two or more client will connect to server in single concert. Entering the following command with different operator name java SeatClient Nani Screen Shot.
 
On Nani  GUI window click 4A seat to reserve, if server confirming the request, 4A seat button at Nani GUI windows will change color to green. At this point go to Eric GUI windows and click 4A seat to reserve this seat, and you  will found out that the seat already get reserve by other operator with the message 'Already Reserved' at Eric output terminal  Screen Shot. When Eric press allocate button, 4A seat in reserve status ( green color) will not change to red color because this seat does not reserve by Eric.
 
When the Nani and Eric GUI window  terminate/close the windows, this message  'Connection completed: closed socket'  will appear at server terminal Screen Shot. Whenever new operator or server get restart, all previous seat status still available because all this seat status have been save in test.txt file. To reset all this seat to free status just run java Reset, and press the button.
 
To increase number of seat in particular block at client GUI windows, Change this part of code at SeatServer. java file
 
serverBlock = new Block[3]; serverBlock = new Block[3];
serverBlock[0] = new Block(3,3,27.0); serverBlock[0] = new Block(6,6,27.0);
serverBlock[1] = new Block(4,6,20.0);                                    TO serverBlock[1] = new Block(4,6,20.0);
serverBlock[2] = new Block(2,4,15.0); serverBlock[2] = new Block(2,4,15.0);
serverConcert = new Concert (serverBlock); serverConcert = new Concert (serverBlock);
 
Save this file and compile it, and to prevent any error happen after change the number of seat in particular block,  the Reset.java file must be execute again to delete all previous status. run the Concert Seat Booking Program again and you will found out that client window will look like this Screen Shot. To change the price at particular block also same as you change the number of seat in block.
 

Section that I complete
 
Question 1

Question 2


Enchantments for Concert Seat Booking Program
 
a. When two or more client connect to server, seat button color does not update directly on other client.        
    example: when server confirming the reserve seat(4A) for Nani (operator name), the 4A seat button color 
    only update on Nani window and Eric window still look like previous status. The only way to update the Eric
    window is press any seat button to get all current status  from server (seat button look like refresh button). 
    so the best solution for this problem is the server should broadcast all the seat status to client in every second 
    or whenever the client change the seat status using DatagramPacket and MulticastSocket with address 
    '244.0.0.1'.
 
b. The price of seat in particular block is send back by server and display at client terminal when the server
    confirming the request. To improve this, my suggestion is create another label/text field at client GUI window to
    display price which send back by server.
 
c. When the server increase number of seat in block, sometime it will make Client GUI window look not very
    nice Screen Shot.
 
d. This program also does not support multiple concert but it only support multiple client on single concert.