Assignment java PROG191 (D), Assignments of Information Technology

Assignment java PROG191 (D) who wants to D

Typology: Assignments

2022/2023

Uploaded on 07/04/2023

unknown user
unknown user 🇻🇳

16 documents

1 / 110

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Submission date
23-6-2023
Date Received 1st submission
23-6-2023
Re-submission Date
Date Received 2nd submission
Student Name
Student ID
Gch211372
Class
Gch1105
Assessor name
Nguyễn Đình Trần Long
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Grading grid
Grade (0-10)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Assignment java PROG191 (D) and more Assignments Information Technology in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title

Submission date^23 -^6 -^2023 Date Received 1st submission^23 -^6 -^2023

Re-submission Date Date Received 2nd submission

Student Name Student ID Gch

Class Gch1105 Assessor name Nguyễn Đình Trần Long

Student declaration

I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that

making a false declaration is a form of malpractice.

Student’s signature

Grading grid

Grade (0-10)

❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date:

IV Signature:

  • I. Introduction of the small business problem
  • II. Requirement Analysis & Design
    • 2.1. Use case diagram
    • 2.2 class diagram
  • 2.3 Explain selected data structures used in the project
    • 2.4 Architecture used for the project
    • 2.5 Wireframe (UI design)
  • III. Implementation
  • 3.1 Explain program structures
    • 3.2 Explain classes
    • I. Model (Account, Customer, CustomerDAO)
    • I. View (Home, Login, Register, bill)
    • III. Controller (Customercontroller, LoginController, RegisterController)
    • 3.3 Explain important algorithms
    • 3.4 Explain how to handle errors
  • IV. Result of running program
  • V. Test
    • 5.1 Testing and result
    • 5.2 Junit test
  • V. Evaluation & Conclusion
    • 5.1 Explain opp in my poject
    • 5.2 Evaluate pros/cons of the program In this section, I will give a review of the strengths and weaknesses of my program
      • Advantages:........................................................................................................................................................................................................
    • Disadvantages:
    • Suggestions for improvements:
  • Conclution
  • References
  • Figure 1:Order Management System Use Case Diagram
  • Figure 2: Class diagram
  • Figure 3:Image source code write file..........................................................................................................................................................................
  • Figure 4:Binary converted image
  • Figure 5:Erd diagram
  • Figure 6: Select from customer table
  • Figure 7: Model view controller
  • Figure 8: Wireframe of application..............................................................................................................................................................................
  • Figure 9: wireframe login of application
  • Figure 10: Wireframe register of application
  • Figure 11: Wireframe bill of application
  • Figure 12: View room wireframe.................................................................................................................................................................................
  • Figure 13: My mvc project
  • Figure 14: Source code of class account
  • Figure 15: Source code of class customer
  • Figure 16:Source code of class customer
  • 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

Search Engine Optimization (SEO) Friendly (GeeksforGeeks, 2023).

Disadvantages of MVC:

It is difficult to read, change, test, and reuse this model

It is not suitable for building small applications.

The inefficiency of data access in view.

The framework navigation can be complex as it introduces new layers of abstraction which requires users to adapt to the

decomposition criteria of MVC.

Increased complexity and Inefficiency of data (GeeksforGeeks, 2023).

This application will utilize this model for program development. The model has demonstrated its ability to provide a class diagram

design for the entire program. The class diagram chart is divided into specific partitions for classes belonging to the Controller, View,

database or a list of objects. The text fields are usually grouped and may have labels to indicate the purpose of each field. These fields

allow users to input data or edit existing information. The buttons are placed at the end or next to the text fields and table. These

buttons perform CRUD operations: "Create" to create new data, "Read" to retrieve information from existing data, "Update" to modify

information, and "Delete" to remove information. This wireframe helps developers understand the structure and layout of the interface

before implementing it. It provides a static visual representation of how the interface components interact with each other and are

arranged on the screen.

Figure 9 : wireframe login of application

A wireframe for a login interface with email and password typically includes the following components:

Email Field: This is a text input field where users can enter their email address. It may be accompanied by a label or placeholder text

to indicate that it is specifically for the email.

Password Field: This is a secure text input field where users can enter their password. The input characters are usually masked (e.g.,

shown as asterisks) to protect the security of the password.

Login Button: This is a button that users can click to initiate the login process. It triggers the validation and authentication of the

entered email and password.Remember Me Checkbox: This is an optional checkbox that users can select if they want the system to

remember their login credentials for future sessions. Selecting this checkbox may enable automatic login on subsequent visits without

requiring the user to re-enter their email and password.

The wireframe visually represents the arrangement and positioning of these components within the login interface. It provides a

simple and static representation of the interface, allowing designers and developers to plan the layout and interaction flow before

implementing the actual login functionality.

Figure 10 : Wireframe register of application

A wireframe for a registration interface with phone number can include the following components:

Email Field: This is a text input field where users can enter their email address.

Password Field: This is a secure text input field where users can enter their chosen password.