aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes UrlyBird: user input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "UrlyBird: user input " Watch "UrlyBird: user input " New topic
Author

UrlyBird: user input

Axel Leucht
Greenhorn

Joined: Jan 19, 2009
Posts: 21
I'm curious on my assignment (URLyBird 1.2.2) on the way how yoy guys handle the booking/unbooking of rooms.

I wonder which input do you request from the user when booking a room besides the 8 digit customer id. Do you for example ask the user to input the number of accommodations for the room?

And if you do, I wonder how you handle tihe unbooking of a room? When a room is booked lets say for 5 days, when do you let the user unbook the room? The booking period might be shorter, longer than requested. How do cope with it?

Thanks for helping.


Regards

SCJP, SCJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5536
    
  13

Hi Alex,

I took a very simple approach:
  • no unbooking (not required by the instructions)
  • when user selects a room from the table (and that room isn't booked already) and clicks the book button, a dialog is shown which requires a valid customer id. When the user confirms this dialog (click ok button), the booking process starts (locking the record, checking if no other client already booked that room,...).

  • That's it. Pretty easy, isn't it

    Kind regards,
    Roel


    SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
    http://www.javaroe.be/
    Axel Leucht
    Greenhorn

    Joined: Jan 19, 2009
    Posts: 21
    Hi Roel,

    thanks for you're input.

    Do I understand you correctly that once you booked a room you can't book it again (and it stay booked forever) as it is now booked?

    I reread my assignment and indeed the unbooking method isn't required, but this seems to be weird to me, isn't it?
    K. Tsang
    Bartender

    Joined: Sep 13, 2007
    Posts: 2594
        
        9

    Axel Leucht wrote:Do I understand you correctly that once you booked a room you can't book it again (and it stay booked forever) as it is now booked?

    I reread my assignment and indeed the unbooking method isn't required, but this seems to be weird to me, isn't it?


    Hi Axel, the assignment really requires the book and search methods. Once a room is booked, it is booked. You may provide a unbook method for the client UI but that's not necessary. If you asked about the book method, you may also wondering what about the delete method (like once a room is created, can I delete it).

    In my implementation of UB I provided book/unbook, search, create/delete methods. Again the delete method is not necessary. Now regarding your earlier post about when to you allow a room to unbook itself... I did mine as anytime. Meaning once I book it, I can immediately unbook it. You may noticed the 48-hour window for booking rooms. I used this info to set the date also. Some people just ignore the date when booking rooms.


    K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
    Roel De Nijs
    Bartender

    Joined: Jul 19, 2004
    Posts: 5536
        
      13

    Hi Axel,

    The assignment is more than complicated enough, so I did only what was required:
  • only find and book available from the gui
  • my data class has implementation for all methods (create, delete, read, update,...), but only a few (read, find, update, lock,...) are invoked somewhere in the program.
  • did nothing with the 48 hours rule, except mentioning it in the choices.txt why i didn't handle it.


  • So you can now implement unbook functionality and do a lot of thinking about it, with some rules. And then the business guys come up with a whole other set of rules for unbooking a room, so all your work will be gc'ed

    They asked for finding rooms and booking a room, so that's what they got. And indeed it's a bit weird, but you won't get any extra credit/points for doing more than what's expected, you may even lose some points...

    Kind regards,
    Roel
     
    wood burning stoves
     
    subject: UrlyBird: user input