This assignment aims to establish a basic familiarity with the Java API (Swing and AWT packages) for creating graphical user interface (GUI) and handling events related to GUI. Students should apply the appropriate Java programming fundamentals, object-‐oriented, GUI and event handling concepts that they have learnt to solve the given problem.
On completion of this assignment a student should be able to write a GUI application that:
This assignment is based on individual effort. You are required to design, develop and test a Java application named "RR Theme Park". This is basically an online booking system that allows a customer to theme park tickets online. This application will then display the customer’s order and allow him/her to provide address and contact and details for delivery and tracking purpose. If the customer has ordered previously and his/her information has been recorded, the application will allow him/her to retrieve his/her information. A customer should also be able to track the order status.
Besides providing the required functionalities, your program should incorporate appropriate error handling. Comments are also to be inserted to improve program clarity. Before you start coding your program, you are strongly advised to carry out proper problem analysis and program design.
You are required to use JDK 1.5 developer version or later.
Your program must satisfy all the requirements as described in this section. Take note that all required input / output are carried out through a graphical user interface. Make use of what you have learnt pertaining to Java GUI and event handling concepts to design and build this application.
(a) Loading Customer Data from a Text File
A text file (customerInfo.txt) as shown below should be prepared. Each line shows a customer’s name, username, password, address and contact number, each separated by a delimiter “;” from each other. You should create 3 entries (as least) manually for testing purpose. See image.
(b) Display of Main Page
When your program starts, a main page as shown below should be displayed. The display should be approximately as demonstrated, no necessarily precisely the same. The pictures do not have to be the same or be presented in exactly the same way. See image.
(c) Selection of Tickets – Tickets Tab
If Tickets Tab is selected, RR Theme Park ride tickets prices as shown in Figure 3 will be displayed, along with the prices for child and adult. Your program needs to display 5 different types of rides available. At this point, a customer should be allowed to select the number of Child or Adult ticket associated with each ticket item. The system should allow the customer to select a value between 0 to 10 inclusive per size per ride item. See image.
The system should also display the total number of ride tickets booked and the total price incurred thus far. Take note that the total number of tickets and the total price should be updated every time the customer selects a value in one of the combo box. A message should be displayed to indicate to the customer that he/she can select the Booking Tab when he/she is done with the selection.
(d) Display of Booking Summary – Booking Tab
If Booking Tab is selected, your program will display the customer’s booking. The GUI for the Booking Tab should be as shown in Figure 4. The Booking Tab consists of three panels, each for one step in the order confirmation process including:
BookingDetails-‐Panel should show each ordered ride item and associated quantities. As a customer selects the ride items in the Tickets Tab, the content of this panel should be updated.
Therefore, at anytime when the customer switches to Booking Tab, he/she should be 5 able to view an updated summary of his/her order. See image.
(e) Customer details for Existing Customers
An existing customer can enter username and password at the ExistingCustomer-‐ Panel and then press the “Login” button to retrieve his/her information. As the customer enters his/her password, the actual character will not be display, each character will be replaced by a ‘•’ (please refer to Figure 5).
The provided username and password will be checked against information in the file customerInfo.txt. If the username and password are valid, his/her information will be displayed as shown in Figure 5. Otherwise, an error message will be shown as in Figure 6. See image. See image.
(f) Customer details for new customer
A first-‐time customer can enter his/her personal information into the form at NewCustomer-‐ Panel and then click “Register” to create new account. A message should also be shown to confirm on the successfully creation of the new account (refer to Figure 7). See image.
The New Customer form should allow the password to be entered twice. The customer’s information should be saved in customerInfo.txt.
(g) Delivery options and confirmation
A customer who wants to confirm his/her order will be required to provide the delivery date and time at Deliver-‐Panel. Your program should allow the user to select one of the two options, i.e. Self-‐Collect and By Post. See image.
Once the customer has successfully provided the delivery option, he/she can press the “Confirm” button to confirm and end the program. Once the “Confirm” button is clicked, your program should check the following conditions:
If one of the above conditions is not satisfied, the program should inform the customer through a dialog box. If all the conditions are satisfied, the following steps will take place:
(h) Saving to file
After an order has been placed and confirmed by a customer, the booking details are saved to the file. Each order is recorded in one line containing: order ID, username, date of use, delivery option and order’s status; each separated by a delimiter “;” from each other. Below shows the content of orderData.txt after two orders have been confirmed: See image.
The order status can be manually edited by the RR Theme Park system administrator..
(i) Track booking status – Track Tab
A customer can track his/her order status by simply selecting the Track Tab. When the Track Tab is selected, the following GUI is shown: See image.
The customer should enter a valid order ID and click “Track” to retrieve the order information and status. Your program should search the file orderData.txt for the provided bookingID. If the ID is valid, the user name, delivery date, delivery time and the order’s status will be displayed as in Figure 10. If the booking ID does not exist, the error message “Invalid Booking ID. Please try again” should be displayed instead.
(j) Program Termination
Your program should continue to run until the customer has pressed the “Exit” button at the Intro Tab or close the window. Before the program terminates, the following dialog box should be shown: See image.
(k) Error Handling
Your program should be able to handle situations where a customer has entered a wrong value. These have been pointed out in Section 4(a) to (j). You should look out for other possible exceptions and handle them too.