• Post Reply Bookmark Topic Watch Topic
  • New Topic

looping in java  RSS feed

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me. i stuck with this problem for weeks.

_ M T W Th F S Su M T W Th F S Su
_ 1 2 3 4 5 6 7 8 9 10 11 12 13 14
A D D X X N N XR X D D X XR N N
B N N X X D D XR X N N X XR D D
C X X D D XR X N N X XR D D X X
D X X N N XR X D D X XR N N X X


M-Monday, T-Tuesday, W-Wednesday, Th-Thursday, F-Friday, S-Saturday, Su-Sunday

there is 4 teams called A, B, C, D
the shift pattern follow the pattern "DDXXNNXX" which is 2 day shift follow by 2 rest day follow by 2 night shift. and then after that the pattern repeated.
i was able to generate the results properly but it is just for a year. i need the results which should be generated continuously. thanks in advance for your helps.
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to think about your algorithmns and how you are working things out.

What have you achieved so far? How have you worked out the pattern to date? What algorithm are you using? How are you working out how many days have elapsed? Do the shift patterns continue uninterrupted Summer and Winter without changes for holidays, etc? What Java™ classes are you using to work out those dates?
Use a pencil and paper to write down how you intend to plan those shifts.
 
gana rajan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i worked on it for 1 month. by now i've finished a calendar function and the patterns separately. when i tried to implement it together there's where i'm going crazy. the patterns that i've done is staic which means it will display results for 1 year. so, when i try to see the results for the next year it did show me the same results as last year. the next year result should be displayed based on last year result. if last 2 days of december this year (2012) is finished as 'D' shift then the first day of next year (2013) should be start with 'X' not 'D'. I supposed to finished it by end of next week. to tell the truth it was a php project. i done it in java first then convert it to php. so, That's why i'm seeking help in this java forum. i did not use any class and i use if...else loop only.

if you want to see the code i can post it here. thanks for your time. i really need a start over here. i stuck with the same problem for 2 weeks. hope someone could help me.
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not that helpful to see code. Algorithms are what you need to consider.
 
gana rajan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
algorithm is the one that i'm looking for.
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gana rajan wrote:algorithm is the one that i'm looking for.


gana rajan wrote:
the shift pattern follow the pattern "DDXXNNXX" which is 2 day shift follow by 2 rest day follow by 2 night shift. and then after that the pattern repeated.
i was able to generate the results properly but it is just for a year. i need the results which should be generated continuously. thanks in advance for your helps.



Please explain you working algorithm that works for only a year. Please explain what you did to extend it to more than a year -- did so far. And please explains the issues that you ran into.

With that, hopefully, we'll have enough data to help you brainstorm out the solution. Or if not, come back with more questions.

Henry
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!