Figure 8: Wireframe of application..............................................................................................................................................................................
Figure 17:Figure 14: Source code of class customerDAO...........................................................................................................................................
Figure 18:Figure 14: Source code of class customer
Figure 19:Source code of class Home..........................................................................................................................................................................
Figure 20: Source code of class Home.........................................................................................................................................................................
Figure 21:Source code of class Home..........................................................................................................................................................................
Figure 22: Source code of class Home.........................................................................................................................................................................
Figure 23:Source code of class Home..........................................................................................................................................................................
Figure 24: Source code of login
Figure 25:Source code of register
Figure 26:Source code of register
Figure 27: Source code of CustomerController
Figure 28:Source code of CustomerController
Figure 29:Source code of CustomerController
Figure 30:Source code of CustomerController
Figure 31: Source code of edit algorithms
Figure 32:Source code of search algorithms
Figure 33: Source code of check room algorithms
Figure 34: Source code of sort by room algorithms
Figure 35: Handle the error of textname
Figure 36: Result handle the error of textname
Figure 37:handle the error of textage
Figure 38: Result handle the error of textage
Figure 39:handle the error of textProvince
Figure 40: Result handle the error of textProvince
Figure 41:handle the error of textDate
Figure 42: Result handle the error of textDate
Figure 43: Result handle the error of textDate
Figure 44:handle the error of textHours with try-catch
Figure 45: Result handle the error of textHours with try-catch
Figure 46: Result handle the error of textHours with try-catch
Figure 47: handle the error of textEmail
Figure 48: Result handle the error of textEmail
Figure 49: handle the error of textPhone
Figure 50: Result handle the error of textPhone
Figure 51:handle the error of textPassword
Figure 52:Result handle the error of textPassword
Figure 53:handle the error if the user enters a date in the past
Figure 54: Result handle the error if the user enters a date in the past
Figure 55:handle the error with thows
Figure 56:handle the error with thows
Figure 57:register page
Figure 58: login page
Figure 59:Main screen
Figure 60:Before add information in to table:
Figure 61:after add information in to table:
Figure 62:Edit information in the table
Figure 63:Before Remove information in the table
Figure 64:After Remove information in the table
Figure 65:List customer to view room
Figure 66:view room page
Figure 67: Before Search by name:..............................................................................................................................................................................
Figure 68:After Search by name:
Figure 69:Back after search :
Figure 70: Before in bill
Figure 71: After in bill
Figure 72:Before Sort total price:
Figure 73:after Sort total price:
Figure 74: Test pakage
Figure 75: TestAddCustomer Junit Test
Figure 76: TesteditCustomer Junit Test
Figure 77:TestgetCustomer Junit Test
Figure 78:TestremoveCustomer Junit Test
Figure 79: TestsearcheCustomer Junit Test
Figure 80:TestcheckroomCustomer Junit Test
Figure 81: Result all Junit test
Figure 82: Encapsulation image
Figure 83: Inheritance image
I. Introduction of the small business problem
Currently, the number of hotel bookings has increased significantly, and manual management has become complex and challenging.
Therefore, we have decided to create a Java application to manage hotels.
In today's modern era, the hotel industry is experiencing rapid growth with an increasing number of room reservations. However, manual
hotel management has become increasingly complex and burdensome. To address this issue, we have made the decision to develop an
efficient Java application for hotel management.
With our application, we aim to provide an automated and convenient solution to enhance hotel management efficiency. By using our
Java application, hotels can manage customer information, make room reservations, check room availability, and perform other
important tasks quickly and accurately.
With a user-friendly interface and flexible features, our Java-based hotel management application will help hotel staff save time and
effort, improve customer service capabilities, and enhance overall operational performance.
II. Requirement Analysis & Design
Analysis and design of the application are crucial for improving understanding of it. The analysis and design of an application are
essential for gaining a comprehensive understanding of its functionality. To aid in the study and design of an order management system,
several diagrams can be utilized:
Use Case Diagram: This diagram helps identify the various interactions between system users and the order management system. It
illustrates the different actions and features supported by the system, such as placing orders, managing inventory, generating reports,
and handling customer inquiries.
Class Diagram: A class diagram provides an overview of the system's structure by depicting the classes, attributes, and methods involved.
It showcases the key entities in the order management system, such as orders, products, customers, and employees, along with their
relationships. This diagram assists in understanding the data model and the associations between different entities.
Sequence Diagram: By illustrating the sequence of events and interactions between objects or components, a sequence diagram helps
comprehend the dynamic behavior of the system. It visualizes the flow of messages exchanged during various processes, such as order
processing, inventory updates, and notifications to customers.
The use case described above represents the behavior encapsulated within the application. In this particular application, there is a single
user participating object known as the Admin. The use case diagram illustrates the relationships between different use cases. These
relationships are represented by dashed arrows and annotated with the "<>" notation, indicating the use case that must be executed first
in order for another use case to be executed.
The dashed arrows signify dependencies between use cases, indicating that one use case includes or incorporates the functionality of
another. This means that in order to perform a specific use case, the included use case must be executed first to ensure the necessary
prerequisites are met.
By using the annotation, it becomes clear which use case is required to be executed prior to the use case in question. This helps to define
the logical flow and sequence of actions within the application, ensuring that the necessary steps are followed for successful execution.
Overall, the use case diagram with dashed arrows and annotations provides a visual representation of the relationships and dependencies
between use cases, enhancing the understanding of the application's behavior and the order in which specific actions should be
performed.
2.2 class diagram
The above class diagram depicts the classes that are utilized in the implementation of the program. The diagram follows the zoning
principle, organizing the classes into different sections based on the Model-View-Controller (MVC) pattern.
The MVC pattern is a software architectural design pattern that separates the application into three interconnected components: the
Model, the View, and the Controller. Each component has its own responsibilities, promoting modularity and maintainability. In the
class diagram, the classes associated with the Model are grouped together. These classes represent the data and business logic of the
application, handling tasks such as data storage, retrieval, and manipulation. They encapsulate the core functionality and underlying
logic of the application.
The classes related to the View are placed in a separate zone. These classes are responsible for presenting the data to the user and
handling the user interface. They interact with the Model to retrieve and display the necessary information, providing a visual
representation of the application's state to the user.
Figure 2 : Class diagram
2.3 Explain selected data structures used in the project
File storage
Programmers can focus on working with a stored ArrayList and are not required to design a file storage function with a specific structured
format. This helps to reduce the time required for program development and simplifies the file storage commands.
Nevertheless, there are drawbacks to consider when using this file storage method. Editing the file becomes challenging as there is no
clear indication of where changes can be made. In contrast, using a structured archive with explicit rows and columns allows users to
access and modify specific values with ease. This structured format provides a clear understanding of the data layout, facilitating data
manipulation.
Overall, while the current approach simplifies development and file storage commands, it may sacrifice readability and ease of editing.
Developers should carefully consider the trade-offs and choose the appropriate storage method based on the specific requirements of
their application.
Stored using the SQL Server database management system
In order to store data using the SQL Server database management system, the application needs to undergo a few configuration steps
and establish a connection between the application and the database. This connection enables the application to execute SQL statements
within the program when performing actions related to data interactions.
The focus of the application's data storage revolves around two main aspects: storing information about administrators and handling the
system's orders. By utilizing SQL Server, the application can efficiently store and manage these datasets.
To enable data storage via SQL Server, the application needs to set up the necessary configurations. This typically involves providing
the appropriate credentials, such as the server address, database name, username, and password. Once the connection is established, the
application can utilize constructors or methods to execute SQL statements, such as INSERT, UPDATE, DELETE, or SELECT queries,
to interact with the database.
By leveraging the power of SQL Server, the application can efficiently store, retrieve, and manage data related to administrators and
orders. This database management system provides a robust and reliable solution for storing structured data, allowing for efficient
querying and manipulation. It ensures the application can securely and seamlessly interact with the database to meet the specific data
storage requirements.
Figure 5 :Erd diagram
The Order table stores information about orders, including id (primary key), customer name, age, province, phone number, room number,
date, hours, total quantity, and price. The Bill table contains information about bills related to the orders, including bill_id (primary key
and foreign key referencing the Order table), customer name, province, date, and total price. The LoginRegister table stores information
about login/register accounts, including id (primary key), email, and password.
Figure 6 : Select from customer table
Figure 7 : Model view controller
Controller:
The controller is the component that enables the interconnection between the views and the model so it acts as an intermediary. The
controller doesn’t have to worry about handling data logic, it just tells the model what to do. It process all the business logic and
incoming requests, manipulate data using the Model component and interact with the View to render the final output (GeeksforGeeks,
Model:
The Model component corresponds to all the data-related logic that the user works with. This can represent either the data that is being
transferred between the View and Controller components or any other business logic-related data. It can add or retrieve data from the
database. It responds to the controller’s request because the controller can’t interact with the database by itself. The model interacts
with the database and gives the required data back to the controller (GeeksforGeeks, 2023).
View:
The View component is used for all the UI logic of the application. It generates a user interface for the user. Views are created by the
data which is collected by the model component but these data aren’t taken directly but through the controller. It only interacts with
the controller (GeeksforGeeks, 2023).
Advantages of MVC:
Codes are easy to maintain and they can be extended easily.
The MVC model component can be tested separately.
The components of MVC can be developed simultaneously.
It reduces complexity by dividing an application into three units. Model, view, and controller.
It supports Test Driven Development (TDD).
It works well for Web apps that are supported by large teams of web designers and developers.
This architecture helps to test components independently as all classes and objects are independent of each other