Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
On my Assignment sheet on the Button Events part it says.
" If the source of a button event is 'BOOK SINGLE ROOM' or 'BOOK DOUBLE ROOM' the Vector of Rooms should be searched, over the range for bedrooms, to ensure that there is a vacant room of the requested type: otherwise a suitable message is displayed stating that there are no rooms available."
" If there is a vacant room (ie the getCustomer() method returns null) then the user is requested to input the name of the customer, and the room is booked using the bookRoom(String) method. The JLabel associated with the room is to show the text 'OCCUPIED'"
My question is how do I search a vector to see if there is a vacant room?
The code I have for the Hotel GUI class where I have created the Vector and added the Bedroom & MeetingRooms to it is
And the code that I have for the Room & Bedroom class's is
Please avoid very long lines; they make the code hard to read. I have split the longest line, and you can see how it ought to be done. CR[/edit]
Why do you have panels called bedroom101, bedroom102, etc (or similar). Why can't you write a loop which will initialise them, and associate them with a Bedroom object? You can even set up a Map<Bedroom, Panel> which will allow you to find the panel from the associated Bedroom.