HCMC UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY OF INFORMATION TECHNOLOGY FINAL TERM PROJECT Course name: Data Structures and Algorithms DESIGN DATA STRUCTURES, ALGORITHMS AND BUILD A HOTEL MANAGEMENT SOFTWARE Lecturer name: Assoc. Hoang Van Dung List of members Student ID Student Name Contribution (%) 22110048 Nguyen Hoang Lam 100% 22110060 Nguyen Tan Phat 100% 22110080 Ly Dang Trieu 100% Ho Chi Minh City, December 2023 LIST OF MEMBER Class: Monday – Lesson 9-12 Contribution No. Student ID Student Name (%) 1 22110048 Nguyen Hoang Lam 100% 2 22110060 Nguyen Tan Phat 100% 3 22110080 Ly Dang Trieu 100% Note: - Contribution (%) = 100%: Percentage level of each student participating - Leader: Nguyen Tan Phat _________________________________________________________________________ Lecturer note:. December … , 2023 Lecturer Signature Hoang Van Dung -1- PREFACE To fully adapt this topic and report, we would like to express our sincere thanks to lecturer, associate professor Hoang Van Dung, who directly supported us throughout the process of working on the topic.
We appreciate you for guiding us to complete this topic, always answer questions and provide timely comments and corrections, help us overcome our shortcomings and complete it on time. We finished the topic and report in a short period of time, with lack of knowledge and experience in implementing a software project. Therefore, there will be some unpredictable mising from us, so we look forward to receive comments from you so that we can do better for our next projects. Finally, we respectfully wish all teachers good health and success in the career of cultivating people.
Once again we sincerely thank you. Ho Chi Minh City, December 2023 Group 10 Nguyen Hoang Lam Nguyen Tan Phat Ly Dang Trieu -2- INDEX Figure list. Reason for choosing topic. Multi-Linked list.
Test/Experimental results and discussions. Login as manager. Login as guard. Login as receptionist.
Login as service staff. Linked list presentation 2. Multi-Linked list presentation -5- TABLE LIST 1. Task division table 3.
Manager function table 3. Staff function table 3. Room function table 3. Main menu display 3.
Manager text file 3. Manager login display 3. Manager options display 3. Edit manager display 3.
Read manager data display 3. Add manager display 3. Remove manager display 3. Manager list display 3.
Write manager file display 3. Save file checker 3. Hotel income display 3. Edit staff display 3.
Add new staff display 3. Delete staff display 3. Sort list by ID 3. Load the staff display 3.
Save the staff display 3. Save file checker -6- 3. View staff information 3. Receptionist menu display 3.
Room management menu display 3. All rooms list display 3. All booked rooms display 3. All rented rooms display 3.
Check-in display 3. Check-in successfully show 3. Reserve room display 3. Check-out room display 3.
Reset room display 3. Service staff menu display 3. Services menu display 3. Service used display -7- A.
Reason for choosing topic: Technology plays a huge role in our everyday lives. It has also become integrated into the daily operations of hotel management. By leveraging the latest technologies, businesses can streamline operations, increase efficiency, and improve customer service. This helps to reduce costs, increase revenue, and ensure long-term profitability.
Therefore, our group decided to choose the topic which to design data structures, algorithms and build a hotel management software. Applying technology to hotel management help user to optimize the amount of manual management on paper that waste lots of time, narrow storage space, avoid losing data, reduce costs and human resources, so that improve work efficiency and product quality. Software feature: - To login as a staff in a hotel - Can manage the hotel as a manager - Update information (ID, Name, Password, Address, Age, Gender, Day Joined) - Update room ( ) Decide to let the guest rent, book or return the room or not - Caculate income 3. Expected interface: - Menu to choose which position to login as (manager, accountant, security…) - Login console (Type ID, Pasword) - Manager interface + Can hire or fired the staff, can search for other staff ìnormation - Receptionist interface + Can see the room status (rented/booked/empty) so that decide to let the guest rent or book the room - Accountant interface + To caculate revenue and expenditure - Service staff interface + Guest can use the service so that the income will increase -8- 4.
Planning Date Task Note 6th-12th, Design view level, logical level, make diagram November 13th-19th, Divide work to do, code, study about the November software on internet 20th-26th, Code, write an asingment, make presentation, November fix code bugs 27th, Submit the project November 1. Division Completion Name Task (%) Nguyen Hoang Lam Design view level Design logical level 100% Write code Write assignment Nguyen Tan Phat Design view level Make diagram 100% Write code Writing assingment Ly Dang Trieu Design logical level Write code 100% Design and fix bugs Make presentation 1. Task division table -9- B. Project descriptions: A hotel need to manage and control the people who work in the hotel and arrange all the rooms in the hotel, so that it needs to have a software to manage the manager, the accountant, the receptionist, the service staff and rooms including these information: - All the staffs and managers at login console such as account, password, information, salary - The manager such as edit manager list, edit every staff list and check the hotel income - The receptionist such as rent room, book room, reserve room, show all room - The service staff such as using the service - Rooms such as ID, type, status, day begin, day end, money 2.
Programming method: Data Structures and Algorithmsin introduce abstract concepts for data organization and manipulation, to show how these concepts are useful in problem solving. - Basic – used data structures: Lists, Stacks, Queues, Trees, Hash tables. - Algorithms in data structures: Sorting, searching, inserting, deleting. - Apply data structures to solve practical problems - Programming language: C++ 2.
Linked list: Linked list is using a structure which allows to store elements in a list A linked list is made of nodes that are pointing to each other - Link: each link of linked list can store data called an element - Next: every link of linked list store a link to the next element called Next - Head: a linked list such as links link to first element called Head 2. Linked list presentation -10- Linked list’s basic functions: - Insertion: insert an item at the beginning, at the end, after a node - Removing: delete an item at the beginning, at the end, after a node - Searching: Search a node in a list 2. Multi-Linked list: - Inserting into this structure is very much like inserting the same node into two separate lists. In multi-linked lists it is quite common to have back-pointers 2.
Multi-Linked list presentation -11- C. Struct: No Name Purpose. 1 NodeGD //Store information for user account struct NodeGD { string username; string password; NodeGD* next; NodeGD }; 2 NodeNV //Store staff information struct NodeNV { string ID; string name; string password; string address; int age; string gender; string dayJoined; NodeNV* next; }; 3 NodeRoom //Store room information struct NodeRoom { string roomID; string roomType; string status; // 0-empty, 1-rented, 2-booked string dayBegin; string dayEnd; float money; NodeRoom* next; }; 3. For manager: No.
Purpose Code 1 Add //Add manager to the front of the list manager void addFirst(string username, string password) { -12- NodeGD* temp = new NodeGD{ username, password, head }; -12- head = temp; total++; } //Add manager to the last of the list void addLast(string username, string password) { NodeGD* temp = new NodeGD{ username, password, nullptr }; if (head == nullptr) head = temp; else { NodeGD* move = head; while (move->next != nullptr) move = move->next; move->next = temp; } total++; } // Add manager to position pos of the list void addItem(int pos, const string& username, const string& password) { if (pos <= 0) { addFirst(username, password); } else if (pos >= total) { addLast(username, password); } else { NodeGD* temp = new NodeGD{ username, password, nullptr }; NodeGD* move = head; for (int i = 0; i < pos - 1; i++) { move = move->next; } temp->next = move->next; move->next = temp; total++; } } //Delete manager at position pos void deleteItem(int pos) { Delete 2 if (pos < 0 || pos >= total) { manager cout << "Invalid position for deletion" << endl; return; -13- } if (pos == 0) { NodeGD* temp = head; head = head->next; delete temp; total--; } else { NodeGD* current = head; for (int i = 0; i < pos - 1; i++) { current = current->next; } NodeGD* temp = current->next; current->next = temp->next; delete temp; total--; } } Free //Delete all data of manager memory of void FreeMemory() { manager NodeGD* current = head; NodeGD* next; while (current != nullptr) { next = current->next; 3 delete current; current = next; } head = nullptr; total = 0; } 4 Read //Read data from manager text file manager file bool ReadFileToLinkedList(LinkedListGD& GiamDocList) { ifstream ifs; ifs.txt"); if (!ifs) { cerr << "Can't open file!\n"; return false; } string line; while (getline(ifs, line)) { istringstream iss(line); string username, password; if (iss >> username >> password) { -14- If we want to add a manager, we have to input the new manager’s name and a password for the account too 3. Add manager display If we want to remove a manager, we just need to type the manager’s name and confirm the deletion 3. Remove manager display Then we can display all the manager to check the manager list if it has changed like what we did 3. Manager list display -26- And to save all the data of the manager we have edited we will overwrite it into the manager text file 3.
Write manager file display To ensure that user want to save this file to the text, we include the checker in order to make sure that the user won’t forget to save their files 3. Save file checker If we choose to see the income it will show the money of all the room that we have gain before -27- 3. Hotel income display If we choose to edit the staff information, the display of some options are different from the rest while editing the manager. Take the security staff for an example: 3.
Edit staff display -28- Unlike adding a manager, adding a staff require to input the ID, name, password, address, age, gender, day joined 3. Add new staff display And with the deleting a staff you will have to input the ID and the name of the staff 3. Delete staff display After we add some more staff the list would be a mess, but we could sort the list again by the ID, if the list is sorted by ID already it will notify that -29- 3. Sort list by ID We add a checker to check whether the user want to load or not 3.
Load the staff display This is the same with the previous but for the written one -30- 3. Save the staff display And to ensure that user want to save this file to the text, we include the checker in order to make sure that the user won’t forget to save their files 3. Save file checker 2. Login as guard: If we login as a guard or as other staffs there is alway have an option, it is view the user information.
View staff information 2. Login as receptionist: If we login as a receptionist, there are 2 options such as view your information and manage rooms 3.