COIT20245 - Java Hotel Booking Program using Array of Objects(2024)
VerifiedAdded on 2024/04/26
|16
|1328
|315
Project
AI Summary
This Java project, developed for COIT20245 - Introduction to Programming, implements a hotel booking system using an array of objects. The system allows users to enter customer names and the number of days they wish to stay, display all customer bookings with their associated charges, display booking statistics such as maximum stay, minimum stay, average stay, and total charges, search for specific bookings by customer name, sort bookings alphabetically by customer name, and exit the application. The project includes a UML class diagram, implementation screenshots, and test cases to demonstrate the functionality and robustness of the system, addressing potential issues like handling blank inputs and validating data ranges. The code is well-structured and incorporates error handling to ensure a user-friendly experience.

COIT 20245 - Introduction to Programming
Assessment item 2—JAVA Program using array of objects
Student Name: Amair Ali Mohammed
Student ID: 12059308
0
Assessment item 2—JAVA Program using array of objects
Student Name: Amair Ali Mohammed
Student ID: 12059308
0
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Contents
UML Class diagram:........................................................................................................................2
How long it took to create the whole program................................................................................2
Problems encountered:.....................................................................................................................2
Implementation Output screenshots:...............................................................................................3
Test cases:......................................................................................................................................10
References......................................................................................................................................14
Appendix........................................................................................................................................15
List of Figures
Figure 1 UML Class Diagram.........................................................................................................2
Figure 2 menu system......................................................................................................................3
Figure 3Appeared page when user selects menu option 1...............................................................4
Figure 4 Output of Menu 1..............................................................................................................4
Figure 5Appeared page when user selects menu option 2...............................................................5
Figure 6Appeared page when user selects menu option 3...............................................................6
Figure 7Searching of customer name..............................................................................................7
Figure 8Appeared page when user selects menu option 4...............................................................8
Figure 9Appeared page when user selects menu option 5...............................................................9
Figure 10Appeared page when user selects menu option 6...........................................................10
Figure 11Test Case 1.....................................................................................................................10
Figure 12Test Case 2.....................................................................................................................11
Figure 13Test Case 3.....................................................................................................................11
Figure 14 Test Case 4....................................................................................................................12
Figure 15 Test Case 5....................................................................................................................13
1
UML Class diagram:........................................................................................................................2
How long it took to create the whole program................................................................................2
Problems encountered:.....................................................................................................................2
Implementation Output screenshots:...............................................................................................3
Test cases:......................................................................................................................................10
References......................................................................................................................................14
Appendix........................................................................................................................................15
List of Figures
Figure 1 UML Class Diagram.........................................................................................................2
Figure 2 menu system......................................................................................................................3
Figure 3Appeared page when user selects menu option 1...............................................................4
Figure 4 Output of Menu 1..............................................................................................................4
Figure 5Appeared page when user selects menu option 2...............................................................5
Figure 6Appeared page when user selects menu option 3...............................................................6
Figure 7Searching of customer name..............................................................................................7
Figure 8Appeared page when user selects menu option 4...............................................................8
Figure 9Appeared page when user selects menu option 5...............................................................9
Figure 10Appeared page when user selects menu option 6...........................................................10
Figure 11Test Case 1.....................................................................................................................10
Figure 12Test Case 2.....................................................................................................................11
Figure 13Test Case 3.....................................................................................................................11
Figure 14 Test Case 4....................................................................................................................12
Figure 15 Test Case 5....................................................................................................................13
1

UML Class diagram:
A model of Class Diagram is the stationary structure of the system. It helps in determining
relationships among objects, classes, operations, and attributes (Goswami, 2012).
Figure 1 UML Class Diagram
Booking class in the image shown above is a parent class and Hotel class here is Child class. In
both the classes all the attributes are private and methods are public.
How long it took to create the whole program
I completed this whole program in 1 week. Firstly I have researched for this program in 1 day.
After that, I started to create a program.
Problems encountered:
First I faced problem in JOptionPane. When I clicked on cancel button it was giving Null
pointer exception. I have solved this issue using exceptional handling.
2
A model of Class Diagram is the stationary structure of the system. It helps in determining
relationships among objects, classes, operations, and attributes (Goswami, 2012).
Figure 1 UML Class Diagram
Booking class in the image shown above is a parent class and Hotel class here is Child class. In
both the classes all the attributes are private and methods are public.
How long it took to create the whole program
I completed this whole program in 1 week. Firstly I have researched for this program in 1 day.
After that, I started to create a program.
Problems encountered:
First I faced problem in JOptionPane. When I clicked on cancel button it was giving Null
pointer exception. I have solved this issue using exceptional handling.
2
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Second I faced problem in validation like customer name can't be blank, a number of
days can't be blank, maximum limit can't exceed but I have solved all these problems by
doing research.
Implementation Output screenshots:
Figure 2 menu system
3
days can't be blank, maximum limit can't exceed but I have solved all these problems by
doing research.
Implementation Output screenshots:
Figure 2 menu system
3
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Figure 3Appeared page when user selects menu option 1
In the above figure, there are six menus which are ‘Enter customer name and days to stay',
‘Display all customer names, days and charges ‘Display statistics', ‘Search for Booking’, ‘Sort
the Bookings’ and ‘Exit the Application’. User among these menus can select any of the choices.
Figure 4 Output of Menu 1
The above dialog box pops when the user selects choice 1 and the dialog box asks to enter the
customer’s name. After typing name, the user can click on ‘OK’ and if he feels to withdraw then
he can select ‘Cancel' button.
4
In the above figure, there are six menus which are ‘Enter customer name and days to stay',
‘Display all customer names, days and charges ‘Display statistics', ‘Search for Booking’, ‘Sort
the Bookings’ and ‘Exit the Application’. User among these menus can select any of the choices.
Figure 4 Output of Menu 1
The above dialog box pops when the user selects choice 1 and the dialog box asks to enter the
customer’s name. After typing name, the user can click on ‘OK’ and if he feels to withdraw then
he can select ‘Cancel' button.
4

Figure 5Appeared page when user selects menu option 2
The above page opens when the user selects option 2 which are ‘Display all customer names,
days and charges’. This window consists of customer name, days to stay and charges.
5
The above page opens when the user selects option 2 which are ‘Display all customer names,
days and charges’. This window consists of customer name, days to stay and charges.
5
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Figure 6Appeared page when user selects menu option 3
The above page opens when the user selects option 3 which is ‘Display Statistics’. The window
appeared will consist information of the person who has the maximum stay which is Brayden for
14 days, a person with the minimum stay which is Antonio for 1 day, average stay days which is
7.0 days and lastly total charges which is $12130.00.
6
The above page opens when the user selects option 3 which is ‘Display Statistics’. The window
appeared will consist information of the person who has the maximum stay which is Brayden for
14 days, a person with the minimum stay which is Antonio for 1 day, average stay days which is
7.0 days and lastly total charges which is $12130.00.
6
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Figure 7Searching of customer name
The above window appears when the user selects option 4. The Input box asks to enter
customer’s name and here the user has entered ‘Pole’.
7
The above window appears when the user selects option 4. The Input box asks to enter
customer’s name and here the user has entered ‘Pole’.
7

Figure 8Appeared page when user selects menu option 4
After entering ‘Pole’ as customer name the software will display ‘Customer found’. Here
customer name, days to stay and charges have appeared.
8
After entering ‘Pole’ as customer name the software will display ‘Customer found’. Here
customer name, days to stay and charges have appeared.
8
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Figure 9Appeared page when user selects menu option 5
When the user selects option 5 which is ‘Sort the bookings’, the bookings will be organized in
accordance with the alphabetical order of customer name.
9
When the user selects option 5 which is ‘Sort the bookings’, the bookings will be organized in
accordance with the alphabetical order of customer name.
9
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Figure 10Appeared page when user selects menu option 6
When the user clicks on menu 6 which is ‘Exit the application’ then a message will be displayed
saying Thank you.
Test cases:
Now, here I will be showing some test cases to prove that software is working effectively,
efficiently and properly.
Table 1Test Case 1
S.No. Test Case Description Presumed Outcome Actual Outcome
1. When selecting option 1, if
the user does not enter any
customer name and leaves
field blank by clicking OK.
An error will occur as user needs to
put some valid customer name.
The error has displayed, a
dialog box appears saying
that Customer name cannot
be left blanked.
Figure 11Test Case 1
10
When the user clicks on menu 6 which is ‘Exit the application’ then a message will be displayed
saying Thank you.
Test cases:
Now, here I will be showing some test cases to prove that software is working effectively,
efficiently and properly.
Table 1Test Case 1
S.No. Test Case Description Presumed Outcome Actual Outcome
1. When selecting option 1, if
the user does not enter any
customer name and leaves
field blank by clicking OK.
An error will occur as user needs to
put some valid customer name.
The error has displayed, a
dialog box appears saying
that Customer name cannot
be left blanked.
Figure 11Test Case 1
10

Table 2 Test Case 2
S.No. Test Case Description Presumed Outcome Actual Outcome
2. When selecting option 1, if
the user does not enter any
value in days field and
leaves field blank by
clicking OK.
An error will occur as user needs to
put some valid number of days.
The error has displayed, a
dialog box appears saying
that days field cannot be
left blanked.
Figure 12Test Case 2
Table 3Test Case 3
S.No. Test Case Description Presumed Outcome Actual Outcome
3. When selecting option 1, if
the user does not enter a
value of days field in the
range of 1 to14 instead
types some value above 14
or below 1.
An error will occur as user needs to
put some valid number of days
ranging from 1 to 14.
The error has displayed, a
dialog box appears saying
that days field cannot
contain values other than
[1, 14].
Figure 13Test Case 3
11
S.No. Test Case Description Presumed Outcome Actual Outcome
2. When selecting option 1, if
the user does not enter any
value in days field and
leaves field blank by
clicking OK.
An error will occur as user needs to
put some valid number of days.
The error has displayed, a
dialog box appears saying
that days field cannot be
left blanked.
Figure 12Test Case 2
Table 3Test Case 3
S.No. Test Case Description Presumed Outcome Actual Outcome
3. When selecting option 1, if
the user does not enter a
value of days field in the
range of 1 to14 instead
types some value above 14
or below 1.
An error will occur as user needs to
put some valid number of days
ranging from 1 to 14.
The error has displayed, a
dialog box appears saying
that days field cannot
contain values other than
[1, 14].
Figure 13Test Case 3
11
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 16
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.