lOMoARcPSD| 58605085
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. Prof. 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
No.
Student ID
Student Name
Contribution
(%)
1
22110048
Nguyen Hoang Lam
100%
2
22110060
Nguyen Tan Phat
100%
3
22110080
Ly Dang Trieu
100%
Note:
lOMoARcPSD| 58605085
- Contribution (%) = 100%: Percentage level of each student participating
- Leader: Nguyen Tan Phat
________________________________________________________________________
_ Lecturer note:
................................................................................................................................................
................................................................................................................................................
................................................................................................................................................
................................................................................................................................................
December … , 2023
Lecturer Signature
Hoang Van Dung
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.
lOMoARcPSD| 58605085
Ho Chi Minh City, December 2023
Group 10
Nguyen Hoang Lam
Nguyen Tan Phat
Ly Dang Trieu
INDEX
Figure list..........................................................................................................................5
Table list..............................................................................................................................
A. HEADING.....................................................................................................................
1. Reason for choosing topic....................................................................................... 2.
Software feature...................................................................................................... 3.
Expected interface................................................................................................... 4.
Plan emplementation...............................................................................................
4.1. Planning............................................................................................................
4.2. Division............................................................................................................. B.
CONTENT....................................................................................................................
1. Project descriptions................................................................................................. 2.
Background knowledges..........................................................................................
2.1. Programming method........................................................................................
2.2. Linked list..........................................................................................................
2.3. Multi-Linked list...............................................................................................
C. CODING SESION........................................................................................................
1. Coding.......................................................................................................................
1.1. Struct.................................................................................................................
1.2. Operation function.............................................................................................
1.2.1. For manager..............................................................................................
1.2.2. For staff.....................................................................................................
1.2.3. For room...................................................................................................
lOMoARcPSD| 58605085
2. Test/Experimental results and discussions.............................................................
2.1. Main menu........................................................................................................
2.2. Login as manager..............................................................................................
2.3. Login as guard...................................................................................................
2.4. Login as receptionist..........................................................................................
2.5. Login as service staff......................................................................................... D.
CONCLUSION.............................................................................................................
1. Conclusions.............................................................................................................. 2.
Future development................................................................................................
REFERENCES...................................................................................................................
lOMoARcPSD| 58605085
FIGURE LIST
2.1. Linked list presentation
2.1. Multi-Linked list presentation
lOMoARcPSD| 58605085
TABLE LIST
1.1. Planning table
1.2. Task division table
3.1.1. Struct table
3.1.2. Manager function table
3.1.3. Staff function table
3.1.4. Room function table
3.2.1. Main menu display
3.2.2. Manager text file
3.2.3. Manager login display
3.2.4. Manager options display
3.2.5. Edit manager display
3.2.6. Read manager data display
3.2.7. Add manager display
3.2.8. Remove manager display
3.2.9. Manager list display
3.2.10. Write manager file display
3.2.11. Save file checker
3.2.12. Hotel income display
3.2.13. Edit staff display
3.2.14. Add new staff display
3.2.15. Delete staff display
3.2.16. Sort list by ID
3.2.17. Load the staff display
3.2.18. Save the staff display
3.2.19. Save file checker
lOMoARcPSD| 58605085
3.2.20. View staff information
3.2.21. Receptionist menu display
3.2.22. Room management menu display
3.2.23. All rooms list display
3.2.24. All booked rooms display
3.2.25. All rented rooms display
3.2.26. Check-in display
3.2.27. Check-in successfully show
3.2.28. Reserve room display
3.2.29. Check-out room display
3.2.30. Reset room display
3.2.31. Service staff menu display
3.2.32. Services menu display
3.2.33. Service used display
A. HEADING
1. 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.
2. 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)
lOMoARcPSD| 58605085
- 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
4. Plan emplementation:
4.1. Planning
Task
Note
Design view level, logical level, make diagram
Divide work to do, code, study about the
software on internet
Code, write an asingment, make presentation,
fix code bugs
Submit the project
1.1. Planning table
4.2. Division
Name
Task
Completion
(%)
lOMoARcPSD| 58605085
Nguyen Hoang Lam
Design view level
Design logical level
Write code
Write assignment
100%
Nguyen Tan Phat
Design view level
Make diagram
Write code
Writing assingment
100%
Ly Dang Trieu
Design logical level
Write code
Design and fix bugs
Make presentation
100%
1.2. Task division table
B. CONTENT
1. 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. Background knowledge:
2.1. 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.2. Linked list:
lOMoARcPSD| 58605085
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.1. Linked list presentation
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.3. 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.2. Multi-Linked list presentation
lOMoARcPSD| 58605085
C.CODING SESSION
1. Coding:
1.1. 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.1.1. Struct table
1.2. Operation function:
1.2.1. For manager:
No.
Purpose
Code
1
Add
manager
//Add manager to the front of the list void
addFirst(string username, string password) {
lOMoARcPSD| 58605085
NodeGD* temp = new NodeGD{ username, password, head };
lOMoARcPSD| 58605085
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++;
}
}
2
Delete
manager
//Delete manager at position
pos void deleteItem(int pos) {
if (pos < 0 || pos >= total) {
cout << "Invalid position for deletion" << endl;
return;
lOMoARcPSD| 58605085
}
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--;
}
}
3
Free
memory of
manager
//Delete all data of manager
void FreeMemory() {
NodeGD* current = head;
NodeGD* next;
while (current != nullptr) {
next = current->next;
delete current;
current = next;
}
head = nullptr;
total = 0;
}
4
Read
manager file
//Read data from manager text file bool
ReadFileToLinkedList(LinkedListGD& GiamDocList) {
ifstream ifs;
ifs.open("D:/GDtext.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) {
lOMoARcPSD| 58605085
GiamDocList.addLast(username, password);
lOMoARcPSD| 58605085
} }
ifs.close();
return true;
}
5
Write
manager file
//Write data to manager text file bool
WriteGDLinkedListToText(const LinkedListGD&
GiamDocList, const string& filename) {
ofstream ofs(filename);
if (!ofs) {
cerr << "Can't open file to overwrite!\n";
return false;
}
NodeGD* move = getFirst();
while (move != nullptr) {
ofs << move->username << " " << move->password << endl;
move = move->next;
}
ofs.close();
return true;
}
3.1.2. Manager
function table1.2.2. For staff:
No.
Purpose
Code
1
Add staff
//Add staff to the front of the list void addFirst(string _ID,
string _name, string _password, string _address, int _age,
string _gender, string _dayJoined)
{
NodeNV* temp = new NodeNV{ _ID, _name, _password,
_address, _age , _gender, _dayJoined, head};
head = temp;
total++;
}
//Add staff to the last of the list void addLast(string _ID,
string _name, string _password, string
_address, int _age, string _gender, string _dayJoined) {
NodeNV* temp = new NodeNV{ _ID, _name, _password,
_address, _age , _gender, _dayJoined, nullptr
}; if (head == nullptr)
head = temp;
lOMoARcPSD| 58605085
else {
NodeNV* next = head;
while (next->next !=
nullptr) next = next->next;
next->next = temp;
}
total++;
}
// Add staff to position pos of the list void addItem(int pos,
string _ID, string _name, string _password, string _address, int
_age, string _gender, string _dayJoined) { if (pos <= 0) {
addFirst(_ID, _name, _password, _address, _age, _gender,
_dayJoined);
}
else if (pos >= total) { addLast(_ID, _name, _password,
_address, _age, _gender, _dayJoined);
}
else {
NodeNV* temp = new NodeNV{ _ID, _name,
_password, _address, _age , _gender, _dayJoined, nullptr };
NodeNV* next = head;
for (int i = 0; i < pos - 1; i++) {
next = next->next;
}
temp->next = next->next; next-
>next = temp;
total++;
}
}
2
Delete staff
//Delete staff at position pos void deleteItem(int pos) { if
(pos < 0 || pos >= total) { cout << "Invalid position for
deletion" << endl; return;
}
if (pos == 0) {
NodeNV* temp = head;
head = head->next;
delete temp;
total--;

Preview text:

lOMoAR cPSD| 58605085
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. Prof. 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: lOMoAR cPSD| 58605085
- Contribution (%) = 100%: Percentage level of each student participating - Leader: Nguyen Tan Phat
________________________________________________________________________ _ Lecturer note:
................................................................................................................................................
................................................................................................................................................
................................................................................................................................................
................................................................................................................................................ December … , 2023 Lecturer Signature Hoang Van Dung 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. lOMoAR cPSD| 58605085
Ho Chi Minh City, December 2023 Group 10 Nguyen Hoang Lam Nguyen Tan Phat Ly Dang Trieu INDEX
Figure list..........................................................................................................................5
Table list..............................................................................................................................
A. HEADING.....................................................................................................................
1. Reason for choosing topic....................................................................................... 2.
Software feature...................................................................................................... 3.
Expected interface................................................................................................... 4.
Plan emplementation...............................................................................................

4.1. Planning............................................................................................................ 4.2.
Division............................................................................................................. B.
CONTENT....................................................................................................................
1. Project descriptions................................................................................................. 2.
Background knowledges..........................................................................................
2.1. Programming method........................................................................................
2.2. Linked list..........................................................................................................
2.3. Multi-Linked list...............................................................................................
C. CODING SESION........................................................................................................
1. Coding.......................................................................................................................
1.1. Struct.................................................................................................................
1.2. Operation function.............................................................................................
1.2.1. For manager..............................................................................................
1.2.2. For staff.....................................................................................................
1.2.3. For room................................................................................................... lOMoAR cPSD| 58605085
2. Test/Experimental results and discussions.............................................................
2.1. Main menu........................................................................................................
2.2. Login as manager..............................................................................................
2.3. Login as guard...................................................................................................
2.4. Login as receptionist..........................................................................................
2.5. Login as service staff......................................................................................... D.
CONCLUSION.............................................................................................................
1. Conclusions.............................................................................................................. 2.
Future development................................................................................................
REFERENCES................................................................................................................... lOMoAR cPSD| 58605085 FIGURE LIST 2.1. Linked list presentation
2.1. Multi-Linked list presentation lOMoAR cPSD| 58605085 TABLE LIST 1.1. Planning table 1.2. Task division table 3.1.1. Struct table 3.1.2. Manager function table 3.1.3. Staff function table 3.1.4. Room function table 3.2.1. Main menu display 3.2.2. Manager text file 3.2.3. Manager login display
3.2.4. Manager options display 3.2.5. Edit manager display
3.2.6. Read manager data display 3.2.7. Add manager display 3.2.8. Remove manager display 3.2.9. Manager list display
3.2.10. Write manager file display 3.2.11. Save file checker 3.2.12. Hotel income display 3.2.13. Edit staff display 3.2.14. Add new staff display 3.2.15. Delete staff display 3.2.16. Sort list by ID
3.2.17. Load the staff display
3.2.18. Save the staff display 3.2.19. Save file checker lOMoAR cPSD| 58605085
3.2.20. View staff information
3.2.21. Receptionist menu display
3.2.22. Room management menu display
3.2.23. All rooms list display
3.2.24. All booked rooms display
3.2.25. All rented rooms display 3.2.26. Check-in display
3.2.27. Check-in successfully show 3.2.28. Reserve room display
3.2.29. Check-out room display 3.2.30. Reset room display
3.2.31. Service staff menu display 3.2.32. Services menu display 3.2.33. Service used display A. HEADING
1. 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. 2. 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) lOMoAR cPSD| 58605085 - 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
4. Plan emplementation: 4.1. 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.1. Planning table 4.2. Division Completion Name Task (%) lOMoAR cPSD| 58605085 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.2. Task division table B. CONTENT
1. 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. Background knowledge:
2.1. 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.2. Linked list: lOMoAR cPSD| 58605085
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.1. Linked list presentation
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.3. 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.2. Multi-Linked list presentation lOMoAR cPSD| 58605085 C.CODING SESSION 1. Coding: 1.1. 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.1.1. Struct table
1.2. Operation function: 1.2.1. For manager: No. Purpose Code 1 Add
//Add manager to the front of the list void manager
addFirst(string username, string password) { lOMoAR cPSD| 58605085
NodeGD* temp = new NodeGD{ username, password, head }; lOMoAR cPSD| 58605085 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; lOMoAR cPSD| 58605085 } 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 bool
manager file ReadFileToLinkedList(LinkedListGD& GiamDocList) { ifstream ifs; ifs.open("D:/GDtext.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) { lOMoAR cPSD| 58605085
GiamDocList.addLast(username, password); lOMoAR cPSD| 58605085 } } ifs.close(); return true; } Write
//Write data to manager text file bool
manager file WriteGDLinkedListToText(const LinkedListGD&
GiamDocList, const string& filename) { ofstream ofs(filename); if (!ofs) {
cerr << "Can't open file to overwrite!\n"; return false; 5 } NodeGD* move = getFirst(); while (move != nullptr) {
ofs << move->username << " " << move->password << endl; move = move->next; } ofs.close(); return true; } 3.1.2. Manager
function table1.2.2. For staff: No. Purpose Code Add staff
//Add staff to the front of the list void addFirst(string _ID,
string _name, string _password, string _address, int _age,
string _gender, string _dayJoined) {
NodeNV* temp = new NodeNV{ _ID, _name, _password,
_address, _age , _gender, _dayJoined, head}; head = temp; total++; 1 }
//Add staff to the last of the list void addLast(string _ID,
string _name, string _password, string
_address, int _age, string _gender, string _dayJoined) {
NodeNV* temp = new NodeNV{ _ID, _name, _password,
_address, _age , _gender, _dayJoined, nullptr }; if (head == nullptr) head = temp; lOMoAR cPSD| 58605085 else { NodeNV* next = head; while (next->next !=
nullptr) next = next->next; next->next = temp; } total++; }
// Add staff to position pos of the list void addItem(int pos,
string _ID, string _name, string _password, string _address, int
_age, string _gender, string _dayJoined) { if (pos <= 0) {
addFirst(_ID, _name, _password, _address, _age, _gender, _dayJoined); }
else if (pos >= total) { addLast(_ID, _name, _password,
_address, _age, _gender, _dayJoined); } else {
NodeNV* temp = new NodeNV{ _ID, _name,
_password, _address, _age , _gender, _dayJoined, nullptr }; NodeNV* next = head;
for (int i = 0; i < pos - 1; i++) { next = next->next; }
temp->next = next->next; next- >next = temp; total++; } } Delete staff
//Delete staff at position pos void deleteItem(int pos) { if
(pos < 0 || pos >= total) { cout << "Invalid position for
deletion" << endl; return; } if (pos == 0) { 2 NodeNV* temp = head; head = head->next; delete temp; total--;