Answer to Question #17805 in C++ for mikey

Question #17805
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.
Expert's answer
#include <iostream>
#include <iomanip>

using namespace std;
class HotelRoom
int _roomNumber;
int _roomCapacity;
int _occupancyStatus;
double _dailyRate;



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);


void HotelRoom::setRoomNumber(int roomNum)
_roomNumber = roomNum;
int HotelRoom::getRoomNumber()
return _roomNumber;
int HotelRoom::setRoomCapacity(int roomCap)
_roomCapacity = roomCap;
return _roomCapacity;
int HotelRoom::getRoomCapacity()
return _roomCapacity;
int HotelRoom::setoccupancyStatus(int occupStatus)
_occupancyStatus = occupStatus;
return _occupancyStatus;
int HotelRoom::getoccupancyStatus()
return _occupancyStatus;
double HotelRoom::setdailyRate(double dRate)
_dailyRate = dRate;
return _dailyRate;
double HotelRoom::getdailyRate()
return _dailyRate;

int main()

HotelRoom* _HotelRoom;
int roomNum;
roomNum = 123;
int roomCap;
roomCap = 4;
double roomRate;
roomRate = 150.00;
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog