• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Calender  RSS feed

 
Sandesh Hiremath
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers!

This is my first post to Java Ranch.

I have an assignment as below. Please guide me if you have any ideas.

Assumption: There is a calender already defined which contains working and non-working day list for a whole year.

I have to create a Calender function whcih takes 2 parameters: one is a date (date of an event) and other is an integer (number of days to complete the event - turn around time).

Now add the int value to event date to find the turn around date, but there may be holidays or non-working days in between. If a holiday is encountered, then add one extra day to the turn around date.

Any help is greatly appreciated. If this is not clear, I can explain again.
 
W. Joe Smith
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems pretty straight forward, depending on how the holiday days are saved. You could calculare the end date, then loop through the calendar starting from your beginning date through your previously calculated end date, saving each holiday and nonworking day as an incrementing counter. Then add the counter to your first end date to get your actual end date (which would now include the time for holidays/non-work days).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!