help sort

Hi Need a little help!! This is the usual manage the hotel program.
What I need to do:
REPORT 1 lists all the occupied rooms and which customer is in each room.
REPORT 2 lists all the empty rooms.
REPORT 3 lists all customers who are checked in and what room they are in.
REPORT 4 lists all customers whoa are not checked in.
REPORT 3 and 4 should be sorted by name.
REPORT 1 and 2 should be sorted by floor and by room.
I need help with the sorting part.Please give an example!!!

//Occupied rooms + customerID report
string Hotel::REPORT1()
{
Room * ptrRoom = getPtrToRoomByID(roomID);
Customer * ptrCust = getPtrToCustByID(customerID);

if((*ptrRoom).whoCheckedIn!=0)
{
return "Room is occupied\n";
}
if((*ptrCust).haveReservation!=0)
{
return "Customer is in the room\n";
}
(*ptrCust).whoCheckedIn=roomID;
(*ptrRoom).haveReservation=customerID;
return "Customer is Checked In\n";
}


//Empty room report
string Hotel::REPORT2()
{
Room * ptrRoom = getPtrToRoomByID(roomID);
if(ptrCust == NULL)
{
return "This room is vacant\n";
}
REPORT2();
}


//Checked in + roomID report
string Hotel::REPORT3()
{
Room * ptrRoom = getPtrToRoomByID(roomID);
Customer * ptrCust = getPtrToCustByID(customerID);
if((*ptrRoom).whoCheckedIn!=0)
{
return "Room already occupied\n";
}
if((*ptrCust).haveReservation!=0)
{
return "Customer is in a room\n";
}
(*ptrCust).whoCheckedOut=roomID;
(*ptrRoom).haveReservation=customerID;
return "Customer is Checked In\n";
}


//Reserved + Not checked in report
string Hotel::REPORT4()
{
Room * ptrRoom = getPtrToRoomByID(roomID);
Customer * ptrCust = getPtrToCustByID(customerID);
if(ptrCust == NULL)
{
return "Customer is not Checked In\n";
}
}




Last edited on
Topic archived. No new replies allowed.