Waived!

LAB EXERCISE 1 PART 2 Based on the given codes forr Hotelh and maincpp create Hotelcpp so that

(4 customer reviews)

Original price was: $10.00.Current price is: $5.00.

Download button will appear immediately after successful payment.

Full support will be provided with necessary files installation.

Get impeccable customized solution within 24 hours, hassle-free.

View Details
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.
Instant
Download

Description

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;

}


You may also like…