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

};

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;
_HotelRoom->setoccupancyStatus(0);
_HotelRoom->setRoomCapacity(5);
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS