Winston Gutkowski wrote:However, there is another (and probably better) alternative: put your "error checking" and "game input evaluation" sections into methods.
Stuart A. Burkett wrote:Just out of interest - why didn't you use an else like you have done with all your other tests ?
Winston Gutkowski wrote:I think what you're looking for is continue. It's another form of loop control, like break (which drops out of a loop immediately), except that it says "skip the rest of the code in this loop and continue with the next iteration". However, there is another (and probably better) alternative: put your "error checking" and "game input evaluation" sections into methods.
Paul Clapham wrote:It seems to me you're making a lot of work for yourself. Apparently you need the user to choose a date? Then why not just use a date chooser component? It's true that Java doesn't come with one, but you can find them on the web easily enough.
Unfortunately, it's a bit fiddly with Java's Date/Calendar API, but the basic idea is this:
1. A day contains 86400 (24*60*60) seconds, or 86400000 milliseconds.
2. Both Date and Calendar can be converted to a millisecond time of the same origin.
3. Subtract the greater time from the lesser and you have the difference in milliseconds.
Winston Gutkowski wrote:Not quite sure what you want. Are you asking: how do I get that information back?
Winston Gutkowski wrote: Make sense?
Winston Gutkowski wrote:Welcome to Java Dates (in fact, date/times in general). If you want a nicer API for them, you might want to take a look at Joda Time; but it doesn't alter the fact that you need to define what a "date" means for your purposes.
Winston
PS: If you want proper validation of the components, I think you'd be better off having your dropdown lists in year/month/day order.