forked from sdjuraev/CProjectUEnter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathService.cpp
More file actions
95 lines (75 loc) · 2.08 KB
/
Service.cpp
File metadata and controls
95 lines (75 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// Created by Windows 10 on 8/14/2025.
//
#include <iostream>
#include <string>
#include "Service.h"
#include <iostream>
#include "Rooms.h"
Service::Service(Rooms* rooms, Rooms* end) {
this->rooms = rooms;
this->end = end;
currentRoom = -1;
service.insert({"Osh", 45000});
service.insert({"Somsa", 10000});
service.insert({"Manti", 10000});
service.insert({"Shashlik", 20000});
service.insert({"Cleaning", 10000});
}
void Service::showServiceMenu() {
std::cout << "\n=== Hotel Services ===\n";
std::cout << "Enter your room number: ";
std::cin >> currentRoom;
if (!isRoomBooked(currentRoom)) {
std::cout << "Room not found or not booked.\n";
return;
}
int choice;
std::cout << "1. Order Food\n";
std::cout << "2. Request Room Cleaning\n";
std::cout << "Enter choice: ";
std::cin >> choice;
std::cin.ignore();
if (choice == 1) {
orderFood();
} else if (choice == 2) {
requestCleaning();
} else {
std::cout << "Invalid choice.\n";
}
}
bool Service::isRoomBooked(int roomNumber) {
//new comment
for (Rooms* ptr = rooms; ptr != end; ++ptr) {
if (ptr->getRoomNumber() == roomNumber && !ptr->getStatus()) {
return true;
}
}
return false;
}
void Service::orderFood() {
int select;
std::cout << "Enter your food orders:\n";
int counter = 1;
for (auto & menu:service)
{
cout << counter<<". " << menu.first << "\t" << menu.second << endl;
counter++;
}
//orderFoodRecursive();
// std::cout << "\n Orders placed for Room " << currentRoom << ":\n";
// for (auto& item : foodOrders) {
// std::cout << "- " << item << "\n";
// }
std::cout << "Enter choice: ";
std::cin >> select;
}
void Service::orderFoodRecursive() {
std::string foodItem;
std::getline(std::cin, foodItem);
if (foodItem == "done") return;
orderFoodRecursive();
}
void Service::requestCleaning() {
std::cout << "Cleaning request for Room " << currentRoom << " has been scheduled.\n";
}