Monday, May 24, 2010

C plus plus question with class?

Open a new C++ source file from Eclipse, and type in the following program.





// your name


//sheet#3, Ex#2





#include%26lt;iostream%26gt;


using namespace std;





class HotelRoom


{





};





//------------------------------------...


int main()


{





return 0;


}


//------------------- The End ----------------------
























































i) Define the following data members of HotelRoom:





3. room_number to indicate the number of the room.


4. floor_number to indicate the number of the floor.


5. type to indicate the type of the room if its single (S) or double (D).


6. booked to indicate if the room booked (1) of free (0).








ii) Define a member function called SetRoomInfo to set the values of room_number, floor_number, type and booked attributes.





iii) Define a member function called ShowRoomInfo to print room_number, floor_number and type.





iv) Define a member function called CheckRoomStatus to check the availability of a room.





v) Define a member function called Booking to book a room.





vi) Declare Room1002 as an object of HotelRoom.





Note that the room number is 100, located in the second floor. It is a double room and available for booking. ( use SetRoomInfo )





Kevin is a customer, he need a double room. Could your program help to book the required room?

C plus plus question with class?
I've always tried this sort of stuff myself. That way I learn crap and don't stay dumb!! If I wasn't prepared to put in the work, I'd DROP THE SUBJECT!!!!!!!!!!!!!!!!!!!!!!!!!!!
Reply:Why ask here? To give away easy points? Then ok.





Finding it dull, boring? You got a problem. Laziness. Shake it off and get to work. It is in these kinds of work you will find bits of interesting things to learn about the language or programming or other tools.
Reply:Yes it could help Kevin...is that your question? :P


No comments:

Post a Comment