Write a program in which you declare a class HotelRoom. The class has the following private instance variables: the room number (a string), the room capacity (an integer representing the maximum number of people the room can accommodate), the occupants status (an integer, 0 if the room is not occupied, otherwise the number of occupants in the room), and the daily rate (a double). Include a three- argument constructor that set the room number to its first argument, the room capacity to the second argument, the room rate to the third argument, and that sets the room occupancy status to 0. Compile and test the program. Note: we will continue this exercise in the next section.
1
Expert's answer
2012-11-02T12:54:26-0400
#include <iostream> #include <iomanip>
using namespace std; class HotelRoom { private: int _roomNumber; int _roomCapacity; int _occupancyStatus; double _dailyRate;
public:
HotelRoom();
void setRoomNumber(int roomNum); int getRoomNumber(); int setRoomCapacity(int roomCap); int getRoomCapacity(); int setoccupancyStatus(int occupStatus); int getoccupancyStatus(); double setdailyRate(double dRate); double getdailyRate(); void initRoom(int roomNum,int roomCap, double roomRate, int occupStatus); int ChangeStatus(int occupStatus); double ChangeRate(double roomRate);
Comments
Leave a comment