|
Re: public method
Why don't you consider this as a problem-solving exercise, and not as a programming exercise. That way you can design your solution, then implement it.
It's pretty clear. You have a list of rooms. These rooms are given from the beginning (lowest numbered room first). They may be vacated in any order.
Each time you need a vacant room, you begin with the first room and go up the list until you find a vacant room.
Obviously, there are conditionals involved. IF a room is not vacant, you can't give it out. If the hotel is full, you can't give out a room. Isn't that easy, if you just think about it and don't get dranoed because it's a "programming" assignment?
Hint: when it comes to the code, think array or list.
|