duty roster
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package dutyroster;
/**
*
* @author PC 48
*/
public class DutyRoster {
/**
* @param args the command line arguments
*/
//setiap hari hanya 3 org yg boleh cuti
int staffNumber;
int date_Start;
int staffcutiday1[][]= new int[7][3];
public void assignStaffcutibyDay(){
//loop for each staff
int countcutiday1=0;
int countcutiday2=0;
int countcutiday3=0;
int countcutiday4=0;
int countcutiday5=0;
int countcutiday6=0;
int countcutiday7=0;
for(int a=0;a<staffNumber;){
int max=6;
int min=0;
int daycuti= (int)(Math.random() * (max - min + 1) + min) ;
if(daycuti==1 && countcutiday1<3){
countcutiday1++;
a++;
System.out.println("Staff "+(a)+" cuti pada hari ke "+ (daycuti+1));
}if(daycuti==2&& countcutiday2<3){
countcutiday2++;
a++;
System.out.println("Staff "+(a)+" cuti pada hari ke "+ (daycuti+1));
}if(daycuti==3&& countcutiday3<3){
countcutiday3++;
a++;
System.out.println("Staff "+(a)+" cuti pada hari ke "+ (daycuti+1));
}if(daycuti==4&& countcutiday4<3){
countcutiday4++;
a++;
System.out.println("Staff "+(a)+" cuti pada hari ke "+ (daycuti+1));
}if(daycuti==5&& countcutiday5<3){
countcutiday5++;
a++;
System.out.println("Staff "+(a)+" cuti pada hari ke "+ (daycuti+1));
}if(daycuti==6&& countcutiday6<3){
countcutiday6++;
a++;
System.out.println("Staff "+(a)+" cuti pada hari ke "+ (daycuti+1));
}if(daycuti==7&& countcutiday7<3){
countcutiday7++;
a++;
System.out.println("Staff "+(a)+" cuti pada hari ke "+ (daycuti+1));
}
}
}
}
Comments
Post a Comment