Repository navigation
Expand file tree
/
Copy pathHomePageInterface.cpp
More file actions
51 lines (43 loc) · 1.49 KB
/
Copy pathHomePageInterface.cpp
File metadata and controls
51 lines (43 loc) · 1.49 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
#include "HomePageInterface.h"
#include <iostream>
#include <string>
using namespace std;
void HomePageInterface::displayHomePage(const Hotel& hotel) {
const Address& addr = hotel.getAddress();
cout << "****************************************************************\n";
cout << " GatorStay! \n";
cout << "****************************************************************\n";
cout << hotel.getRating() << " /5 stars\n";
cout << addr.addressLine << ", " << addr.city << ", " << addr.state << ", " << addr.ZIP << ", " << addr.country << "\n";
cout << "Check-In Time: " << hotel.getCheckIn() << "\n";
cout << "Check-Out Time: " << hotel.getCheckOut() << "\n";
cout << "Hotel Amenities:\n";
for (const auto& amenity : hotel.getAmenities()) {
cout << amenity << "\n";
}
cout << "1). Make a Reservation\n";
cout << "2). Login\n";
cout << "0). Exit\n";
cout << "****************************************************************\n";
}
HomePageChoice HomePageInterface::getUserChoice() {
int choice;
while (true) {
cout << "Enter a choice: \n";
if (cin >> choice) {
if (choice == 0) return HomePageChoice::EXIT;
if (choice == 1) return HomePageChoice::BOOK;
if (choice == 2) return HomePageChoice::LOGIN;
else cout << "Invalid input. Please enter 0, 1 or 2\n";
}
else {
cout << "Invalid choice. Please enter a number\n";
}
cin.clear();
cin.ignore(100, '\n');
}
}
HomePageChoice HomePageInterface::show(const Hotel& hotel) {
displayHomePage(hotel);
return getUserChoice();
}