Search

Solution Cart

Remove item Thumbnail image Product Price Quantity Subtotal
× LAB EXERCISE 1 (PART 2) Based on the given codes for Hotel.h and main.cpp, create Hotel.cpp so that the output will be as shown below: Room Bookings: Room 0 booked by Alice for 3 nights Room 1 booked by Bob for 2 nights Room 3 booked by Carol for 4 nights Room Bookings: Room 0 booked by Alice for 3 nights Room 3 booked by Carol for 4 nights ...Program finished with exit code 0 Press ENTER to exit console. Hotel.h #ifndef HOTEL_H #define HOTEL_H #include #include class Reservation { public: Reservation(int roomNumber, const std::string& guestName, int nights); int getRoomNumber() const; const std::string& getGuestName() const; int getNights() const; private: int roomNumber; std::string guestName; int nights; }; class Hotel { public: Hotel(int numRooms); Hotel(); bool bookRoom(int roomNumber, const std::string& guestName, int nights); bool cancelBooking(int roomNumber); void displayBookings() const; private: int numRooms; std::vector reservations; bool* roomAvailability; }; #endif Main.cpp #include "Hotel.h" #include int main() { Hotel hotel(10); // Creating a hotel with 10 rooms hotel.bookRoom(0, "Alice", 3); hotel.bookRoom(1, "Bob", 2); hotel.bookRoom(3, "Carol", 4); hotel.displayBookings(); hotel.cancelBooking(1); hotel.displayBookings(); return 0; } LAB EXERCISE 1 PART 2 Based on the given codes forr Hotelh and maincpp create Hotelcpp so that $5.00
$5.00
× (b) Modify the program in Q3(a), with the following new rules: - Players will need to win 3 games to become the overall winner. - Implement a penalty - for the player who skipped, entered an incorrect expression, or entered an expression that evaluated to the wrong result, will draw 2 random digits into their hand. - The player who loses the game will be awarded a "Skip" card in the next game. With the "Skip" card, the player can hit < Enter > to skip, without a penalty. - If not utilized, the "Skip" cards CANNOT be carried forward to the next game. Illustration of the "new" game on the left column, with the rules of the game explained on the right column: Enter player: Alan Enter player: Betty Enter player: Starting hand (number) of digits: 4 Let's play... Game 1 Round 1: Result 6 Betty's hand: [5,2,1,1] Enter expression: 5+1 Correct! Betty's hand: [2,1] Alan wins this game in 4 rounds!! Overall game score: Alan 1, Betty 0 Let's play... Game 2 Round 1: Result 5 Betty's hand: [3, 6, 5, 7, 'S'] Enter expression: Skipped with no penalty!! Betty's hand: [3,6,5,7] Alan's hand: [2,1,2,1] Enter expression: Skipped and 2 digits added to hand Alan's hand: [2,1,2,1,4,7] Betty wins this game in 5 rounds!! Overall game score: Alan 1, Betty 1 Let's play... Game 3 Round 1: Result 6 Betty's hand: [1, 2, 8, 7] Enter expression: 8-2 Correct! Betty's hand: [1, 7] Computer randomized the play sequence and will stay the same for every game/round End of game, if no overall winner, continue to play another game. Loser will be awarded a "Skip" card in the next game. "S" represents the "Skip" card awarded to Betty. No penalty for Betty as she has a "Skip" card. Hit < Enter > key to skip if cannot form an expression. In this case, the player who skipped will draw 2 random digits into their hand. End of game, if no overall winner, continue to play another game. Loser will be awarded a "Skip" card in the next game. (b) Modify the program in Q3(a), with the following new rules: – Players will need to win 3 games… $10.00
$10.00

Cart totals

Subtotal $15.00
Total $15.00

You may be interested in…

Free Worldwide shipping

On all orders above $50

Easy 30 days returns

30 days money back guarantee

International Warranty

Offered in the country of usage

100% Secure Checkout

PayPal / MasterCard / Visa