wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: 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 "NX: "Date available" in Hotel Room System" Watch "NX: "Date available" in Hotel Room System" New topic
Author

NX: "Date available" in Hotel Room System

Nick Lee
Ranch Hand

Joined: Dec 17, 2002
Posts: 45
Hi all,
In the Hotel Room booking system,there is a db field named "Data available",I'm confused what's this field for,and now,my answer is,it's the date of the available time,all the fields will be out of date after that time,and I needn't use this field to do any thing.
Am I right on this oponion? The doc is hard for me,a Chinese guy to understand,hope some one can help on that.


Nick Lee
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by Nick Lee:
Hi all,
In the Hotel Room booking system,there is a db field named "Data available",I'm confused what's this field for,and now,my answer is,it's the date of the available time,all the fields will be out of date after that time,and I needn't use this field to do any thing.
Am I right on this oponion? The doc is hard for me,a Chinese guy to understand,hope some one can help on that.

according to my database schema "The single night to which this record relates, format is yyyy/mm/dd"
that says alot about your booking system, besides the fact that its the date for which the booking is made, its also the date you need to compare to when checking if the date is within range, theres a business rule that says it has to be within 48 hours of the room becoming available.
Nick Lee
Ranch Hand

Joined: Dec 17, 2002
Posts: 45
that says alot about your booking system, besides the fact that its the date for which the booking is made, its also the date you need to compare to when checking if the date is within range, theres a business rule that says it has to be within 48 hours of the room becoming available.

Sorry sir,I still confused with what u mean,the room can be booked only around that date?
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by Nick Lee:

Sorry sir,I still confused with what u mean,the room can be booked only around that date?


dont call me sir or when I visit China I wont visit you while I'm there
anyway, you can only book a room for the date that it is available.
and , you can only make the booking within 48 hours of that date.
so if a room is available 2003/06/01, then that is the only night that it will be booked for, and you can only make the reservation on 2003/05/30, 2003/05/31 and 2003/06/01
I hope you're unconfused m'lord, otherwise just ask again
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Originally posted by Ta Ri Ki Sun:
anyway, you can only book a room for the date that it is available.
and , you can only make the booking within 48 hours of that date.
so if a room is available 2003/06/01, then that is the only night that it will be booked for, and you can only make the reservation on 2003/05/30, 2003/05/31 and 2003/06/01
I hope you're unconfused m'lord, otherwise just ask again

Hi,TQ
I think it cannot book the current day's room. that's to say, take the example above, we can book the 2003/05/30 and 2003/05/31,not including 2003/06/01. (I remember you explained this in another thread )
http://www.coderanch.com/t/183230/java-developer-SCJD/certification/questions-new-assignment
I have a question, do we need to update this field
after booking the room? why or why not?
Regards!
Frank
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by frank sun:

Hi,TQ
I think it cannot book the current day's room. that's to say, take the example above, we can book the 2003/05/30 and 2003/05/31,not including 2003/06/01. (I remember you explained this in another thread )
http://www.coderanch.com/t/183230/java-developer-SCJD/certification/questions-new-assignment
I have a question, do we need to update this field
after booking the room? why or why not?
Regards!
Frank


Frank I'm sorry that I left today out of my last explaination, but I do allow bookings on the day, there should be no problem with someone attempting to make a last minute reservation.
now as for updating the date available field, there is no need to do that in this specs, for the purpose of booking a room the only field that is updated is the owner field.
in practice however all fields are updated, albeit with previous values, update takes a String[], so what actually happens in my implementation is that the value of owner is updated in the String[], but the update method overwrites everything in the record, it doesn't know or care what changed.
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Originally posted by Ta Ri Ki Sun:
Frank I'm sorry that I left today out of my last explaination, but I do allow bookings on the day, there should be no problem with someone attempting to make a last minute reservation.
now as for updating the date available field, there is no need to do that in this specs, for the purpose of booking a room the only field that is updated is the owner field.
in practice however all fields are updated, albeit with previous values, update takes a String[], so what actually happens in my implementation is that the value of owner is updated in the String[], but the update method overwrites everything in the record, it doesn't know or care what changed.


Thanks, TQ
But I think, if the date includes 'today', then the time period is 72 hour, not 48 hour.
What do you think?
Regards!
Frank
[ May 10, 2003: Message edited by: frank sun ]
Nick Lee
Ranch Hand

Joined: Dec 17, 2002
Posts: 45
hi TQ,(some one call u this,is it right? )
I think i've grasp what u said,but do I need to update that field after someone book it,to the day when the customer book it?
BTW,ur name looks like a japanese
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by frank sun:


Thanks, TQ
But I think, if the date includes 'today', then the time period is 72 hour, not 48 hour.
What do you think?
Regards!
Frank
[ May 10, 2003: Message edited by: frank sun ]


it is still 48 hours, dont count 3 days back because its 3 days period in which he can book(technically anyway), think of it this way, if on the day you make the booking, say the 3rd of May, then you'll have done it with zero hours, now go back 48 hours no matter what time it is and you get to the 1st of May, my spec is clear about "within 48 hours", and the 1st May is within 48 hours , we dont have a timestamp to make this techinally perfect, but then we dont need it.
now if you dont include today, then think of all the people who make last minute bookings, me included, I'd be turned away
and if you dont include the 1st May and he can only book for the 3rd, on the 2nd and on the 3rd, the user will be angry that the spec says within 48 hours and on the 1st its within 48 hours but he cant book
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Can I be an annoying SOB? Please please please?
Having worked in the travel and transport industry for too many years, I can tell you that a standard requirement is to be able to book anything, anywhere yesterday. At present there is only one real case where it applies, but the travel and transport people are future proofing themselves.
The case in point: I live in Sydney, and want to fly to Honolulu today (I want to fly there anytime ). The flight I catch is QF 003, departing Sydney at 10am on 12 May, and arriving in Honolulu at 23.30 on 11th May.
So therefore, if I was booking the hotel room from my computer in Sydney, I would want to be able to book it for yesterday's date.
This gets far more complex in real life, but it gives you the idea.
So two choices: do you allow bookings for yesterday, or do you document that you are not considering date line variations. Either option should be aceptable.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by Nick Lee:
hi TQ,(some one call u this,is it right? )

yep, everyone except colleagues and immediate family, so please feel free.
I think i've grasp what u said,but do I need to update that field after someone book it,to the day when the customer book it?

no you dont, and if you do update it then it is no longer the "date available" but rather "date booked", usually DB Tables have a timestamp field for that sort of thing, in this case theres nothing like that so dont worry about it.
simply update the owner field so you know who booked the room and that it is booked for that day, other than that dont worry about any updates at all.
BTW,ur name looks like a japanese

thats awesome, altho I'm not japanese, sometimes I wish I was, I confuse some japanese and chinese when I greet them, because then they think I speak the language and start rambling on, but all I know is how to greet , it becomes a problem if they dont speak english because I dont get to clear it up, hehe.
as a kid my mom would take us to the habour and chinese sailors always thought I was chinese, my childhood pictures reveal why, now that I'm grown up I dont look like that anymore, strange, anyway, off-topic rant off, hope I answered your question
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
So therefore, if I was booking the hotel room from my computer in Sydney, I would want to be able to book it for yesterday's date.
This gets far more complex in real life, but it gives you the idea.
So two choices: do you allow bookings for yesterday, or do you document that you are not considering date line variations. Either option should be aceptable.

thats a very good point, and my personal choice would be to not allow it, because even when this application goes online it will always be the server date that gets considered, and not the date from your PC in sydney, also the date available coming into the system can be controlled and timezones can be considered using the location of the hotel, and I'm afraid if its yesterday for a particular location already then the room will not get booked no matter where you are
Nick Lee
Ranch Hand

Joined: Dec 17, 2002
Posts: 45
hi TQ,
I think what u said for some time,now a kind of situation pop up:
a man booked a room in 4th May,the Date Available of that room is 6th May,and he wanna live their since 6th May,that's reasonable i think,after some minutes(hours) some one wanna book the same room(it's still 4th May),but he wanna live their since 5th May.
so,the problem is,can we allow the 2nd one to book the room? if not,the room will be nobody-in for one day,if he can,what is the rule?
hope u can grasp what I mean.
Available date is not the date I wanna live in,how to diff them?
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by Nick Lee:
hi TQ,
I think what u said for some time,now a kind of situation pop up:
a man booked a room in 4th May,the Date Available of that room is 6th May,and he wanna live their since 6th May,that's reasonable i think,after some minutes(hours) some one wanna book the same room(it's still 4th May),but he wanna live their since 5th May.
so,the problem is,can we allow the 2nd one to book the room? if not,the room will be nobody-in for one day,if he can,what is the rule?
hope u can grasp what I mean.
Available date is not the date I wanna live in,how to diff them?

Nick you've misunderstood the business requirements.
available date is not the date from, it is the one and only date, that room can only be booked for one night, and if someone wanted several nights he would have to make several bookings IF there are consecutive nights available, and those would come in the form of several records, therefore several bookings.
If you want to overkill your assignment you can implement bulk booking, that checks for availability of a room over a date range, and attempts to lock all record numbers before booking them all, else notifies the client not all dates are available instead only XY and Z, but I wont do that.
heres a quote from instructions that supports what I've just said.
in database schema...
Date available date 10 The single night to which this record relates, format is yyyy/mm/dd.

you book for a single night , not from that night onwards.
 
jQuery in Action, 2nd edition
 
subject: NX: "Date available" in Hotel Room System
 
Similar Threads
Available Date of Rooms
URLyBird: about the primary key of a record in Data file.
NX: Booking requirement
Please Comment on Data Section
URLyBird Data File Format