Best Regards <br /> <br />Omar F. Kalaldah<br />---------------------<br />SCJP, SCJD, SCBCD
At first I think you should consider renaming your variable currentCalendar to something like lastDate, it is a little bit confusing as it.
But I think this equation is not complete it misses the upper limit and it should be, you book only if:
Available date - 2 < current date < Available date
Yes you are right. But I think the assignment only told us the book rule, not told us un-book rule. The condition: current date >= Available date, if this happen, I think the room will be remove from the available list by other program or by this 'delete' operation. So, I don't do this.
Best Regards <br /> <br />Omar F. Kalaldah<br />---------------------<br />SCJP, SCJD, SCBCD
They take bookings only within 48 hours of the start of room occupancy
Best Regards <br /> <br />Omar F. Kalaldah<br />---------------------<br />SCJP, SCJD, SCBCD
SCJD, SCBCD, SCJP
Where's Andrew, where's Philippe..
SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Originally posted by Leo Tien:
I made the mistake so much, I think I'm confused on time. So I give up the time, and modify my new code.
As you can see, I give up all the time and clear my idea, you can book the room during current date and current date + 2.
What do you think...
:roll:
This will not work properly over the end of year, try it next week.
Solutions involving 86400000 will not work properly over the change to and from daylight saving time.
I use the Excel format since its easy to validate the conversion. The conversion is not valid for years before 1582 or after 4000. There are much better versions of this algorithm available that account for the year which the Gregorian calendar was adopted and for the adjustments after the year 4000.
A clear design, such as will be readily understood by junior programmers, will be preferred to a complex one,...
Originally posted by Leo Tien:
Thanks Peter, I will do my best to understand your code, but now, I will use my code yet, I'm not obstinacy, because your code is more complex.
In the assignment it said that
I think I'm a junior programmer, but I don't understand your code , so I will use my code and will write some word into choices.txt: "In my idea, I don't think about DST, because the assignment didn't tell me clear and in my country don't use it at all.".
Excuse me my foolish act, because it's what I can do
Thanks Peter again.
Originally posted by Leo Tien:
Can someone give me some advice??
Where's Andrew, where's Philippe..
From an earlier post of mine, and definately way beyond scope for this assignment:
When I used to live in Sydney, it was technically possible for me to fly to Honolulu on any day. The flight I would 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.
Do you really want to try and cater for �48 hours and daylight savings and all the other time and date related issues? It is just far too difficult.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
ice is for people that are not already cool. Chill with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|