home *** CD-ROM | disk | FTP | other *** search
- // %PARAMETERS = "CH15LIST C:\UT2004"
- //Identifies the package
- //CH15_04LIST.uc
-
- class CH15_04LIST extends Commandlet;
-
- function int Main(string Args){
-
- //#1
- //Define a customer list
- const iREPS = 3;
- local int iLength, iCtr, iRepCtr, iNum;
-
- local Array<string> rgCustomers;
- local Array<string> rgSallyCustomers,
- rgChuCustomers,
- rgCaesarCustomers;
-
- local string szCustomers, szSallyCustomers,
- szChuCustomers,
- szCaesarCustomers;
- iCtr = 0; iLength = 0; iNum = 0;
-
- szCustomers = "Ali Mo Stu Ed Ira Abe Todd Ham " $
- "Si Lil Min Lo Dli Regi Cal Hal " $
- "Su Len Joy Jay Xi Chi Tan Nu";
-
- //Complete customer list
- Split(szCustomers, " ", rgCustomers);
-
- Log (Chr(10) $" Number of customers: " $ rgCustomers.Length $ Chr(10));
-
- // #2
- iLength = rgCustomers.Length;
- iCtr = 0;
-
- while(iCtr < iLength){
-
- while(true){
- //Each time through distribute 3 customers
- //Take the first from the waiting list
- //Add it to the end of the queue for each representative
-
- iNum = rgSallyCustomers.Length;
- //Add to Sally
- // #3
- rgSallyCustomers[iRepCtr] = rgCustomers[0];
- //Add to the display string
- szSallyCustomers @= rgSallyCustomers[iRepCtr];
- rgSallyCustomers.Insert(iNum,1);
- //Remove first waiting
- rgCustomers.Remove(0,1);
-
- //Add to Chu
- rgChuCustomers[iRepCtr] = rgCustomers[0];
- //Add to the display string
- szChuCustomers @= rgChuCustomers[iRepCtr];
- rgChuCustomers.Insert(iNum,1);
- //Remove first waiting
- rgCustomers.Remove(0,1);
-
- //Add to Caesar
- rgCaesarCustomers[iRepCtr] = rgCustomers[0];
- //Add to the display string
- szCaesarCustomers @= rgCaesarCustomers[iRepCtr];
- rgCaesarCustomers.Insert(iNum,1);
- //Remove first waiting
- rgCustomers.Remove(0,1);
-
- //Increment customer set for representatives
- iRepCtr++;
-
- // #4
- //Break the block for iREPS
- if(iCtr % iREPS == 0 ){
- iCtr += iREPS;
- //Show assigned customers -- account for zero
- if(iCtr != 0){
- Log(" Sally: " $ szSallyCustomers $ Chr(10) $
- " Chu: " $ szChuCustomers $ Chr(10) $
- " Caesar: " $ szCaesarCustomers);
- }
- Log (" " $ Caps("Waiting") $ Chr(9) $ Chr(9)
- $ Chr(9) $ Chr(9)
- $ rgCustomers.Length);
- break;
- }
- }//End inner while
- }//end outer while
-
-
- return 0;
- }