Join 300,327 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,932 people online right now. Registration is fast and FREE... Join Now!
I need your collective support to solve this problem. I don't know even how to beginn. Thanks.
Declare a class HotelRoom. The class has the following private data members: the room number(an interger), the room capacity(an interger representing the maximum number of people the room can accommodate) , the occupancy status ( an interger,0 if the room is not occupied, otherwise the number of occupants, in the room), and the daily rate( a double), The member functions include the following: a three argument function intRoom() that sets the room number to its first argument, the room capacity to the second argument, the room rate to the third argument, and the room capacity status to 0; an accessor function for each data member of the class (Get-Number(), Get-Capacity(), Get-Status(), and Get-Rate()); and a one-argument function Change-Status() that changes the occupancy status of the room to the value of its argument. The function should verify that the argument values does not exceed the room capacity. If it does the function should return –1; and a one argument function Change-Rate() that sets the room rate to the value of its argument. Write a main() that creates a hotel room with room number 123, with capacity of 4, and rate of 150.00. Suppose a person checks in. The program should ask the user to enter the number of guests to occupy the room. Change the status of the room to reflect the number of guests that just checked in. Display the information about the room in a nice format. Now assume that the guests check out. Change the room rate to 175.00. Finally assume that another person checks in. Ask the user to enter the number of guests to occupy the room. Change the room’s status accordingly and display the information about the room.
This post has been edited by no2pencil: 26 May, 2009 - 11:45 PM
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
Please, only use the code tags when you are actually posting code.
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
My problem is how to get to the end. I pose the question again. Declare a class HotelRoom. The class has the following private data members: the room number(an interger), the room capacity(an interger representing the maximum number of people the room can accommodate) , the occupancy status ( an interger,0 if the room is not occupied, otherwise the number of occupants, in the room), and the daily rate( a double), The member functions include the following: a three argument function intRoom() that sets the room number to its first argument, the room capacity to the second argument, the room rate to the third argument, and the room capacity status to 0; an accessor function for each data member of the class (Get-Number(), Get-Capacity(), Get-Status(), and Get-Rate()); and a one-argument function Change-Status() that changes the occupancy status of the room to the value of its argument. The function should verify that the argument values does not exceed the room capacity. If it does the function should return –1; and a one argument function Change-Rate() that sets the room rate to the value of its argument.
cpp
#include <ionstream.p> #include <iomanip.h>
class HotelRoom { private: room number(int); room capacity(int); occupancy status(int); daily rate(double); public: int room( int,int,double); int Get-Number(); int Get-Capacity(); int Get-Status(); double Get-Rate(); int Change-Status(); };
int main()
{
}
*** MOD EDIT: Fixed tags. Only put code into code tags, not text. ***
This post has been edited by JackOfAllTrades: 28 May, 2009 - 04:30 AM
Write the code and if you have any particular problem with it, post your code (or a portion thereof) and specify the problem you are having etc...
Seems quite a straightforward question so whats the problem?
Here is part of code:
cpp
#include <ionstream.h> #include <iomanip.h>
class HotelRoom { private: room number(int); room capacity(int); occupancy status(int); daily rate(double); public: int room( int,int,double); int Get-Number(); int Get-Capacity(); int Get-Status(); double Get-Rate(); int Change-Status(); };
int main()
{
}
This post has been edited by JackOfAllTrades: 28 May, 2009 - 04:23 AM
Were'nt you supposed to have declared your methods with some void or int or whatever. And I don't think you were supposed to leave spaces inbetween your declared variables.
Seems you new to programming, or probably don't know how to continue with inheritance and classes. Have a look at some of our tutorials, it is definitely most helpful, there are some info on classes and inheritance and declaration within methods. Also, your question, break up the question into individual items so you do one thing at a time.
Were'nt you supposed to have declared your methods with some void or int or whatever. And I don't think you were supposed to leave spaces inbetween your declared variables.
Seems you new to programming, or probably don't know how to continue with inheritance and classes. Have a look at some of our tutorials, it is definitely most helpful, there are some info on classes and inheritance and declaration within methods. Also, your question, break up the question into individual items so you do one thing at a time.
int roomNum; roomNum = 123; int roomCap; roomCap = 4; double roomRate; roomRate = 150.00; int i; //number of guests. cout<<"\nEnter number of guests:"<<endl; cin>> i; // i need some help to get further from here return 0; }
This post has been edited by bugema: 1 Jun, 2009 - 12:19 AM