-
-
Save ppajdek/e6b877c3de6c04e1c57bc1ad55c5e0b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int calculateEmployeeSalary(int[][] employeesWorkingSchedule, int employeeId, int dailySalary) { | |
int salary = 0; | |
for (int[] weekSchedule : employeesWorkingSchedule) { | |
for (int dayInWeek = 0; dayInWeek < NUM_OF_DAYS_IN_A_WEEK; dayInWeek++) { | |
int workingEmployeeId = weekSchedule[dayInWeek]; | |
if (workingEmployeeId == employeeId) { | |
salary += dailySalary; | |
if (dayInWeek == SUNDAY) { | |
salary += dailySalary * 0.5 | |
} | |
} | |
} | |
} | |
return salary; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment