looping in java

Discussion in 'Java' started by gana, Apr 19, 2012.

  1. gana

    gana New Member

    Joined:
    Apr 19, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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.
    the rule is the 3rd X (rest day) should be the oncall shift(XR), which run through the calender.

    if team A is D shift then team B should be N shift. if team A and B is working day (regardless shift) then Team C and D will be rest day (X).

    my friend did suggest me to use array but i'm not so good using array functions.
     
  2. gana

    gana New Member

    Joined:
    Apr 19, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    PHP:
           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


    please help me
     
  3. ManzZup

    ManzZup New Member

    Joined:
    May 9, 2009
    Messages:
    278
    Likes Received:
    43
    Trophy Points:
    0
    Occupation:
    Production Manager:Software @ ZONTEK
    Location:
    Sri Lanka
    Home Page:
    http://zontek.zzl.org
    your problem statement is utterly confusing
    can you put the original document statement ?
     
  4. mfred90

    mfred90 Banned

    Joined:
    Mar 28, 2012
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    I am lill bit confuse I am giving you example of do while loop.
    The do...while Loop:
    Code:
    public class Test {
       public static void main(String args[]){
          int x= 10;
    
          do{
             System.out.print("value of x : " + x );
             x++;
             System.out.print("\n");
          }while( x < 20 );
       }
    }
     
    Last edited by a moderator: May 24, 2012

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice