/// <summary> /// /// </summary> /// <param name="employeeDetail"></param> /// <returns></returns> internal int CalculateMonthlyWage(EmployeeDetails employeeDetail) { //Array for daily working hours and daily wages of workers int[] fullDayHour = new int[employeeDetail.noOfWorkingDays]; int workDayCount = 0; int totalWorkingHours = 0; int[] totalDailyWage = new int[employeeDetail.noOfWorkingDays]; int monthlyWage; Console.WriteLine($"Employee wages for {employeeDetail.companyName}"); //calculating total monthly wage by applying while loop on working days while (workDayCount < employeeDetail.noOfWorkingDays && totalWorkingHours <= employeeDetail.hoursPerMonth) { //using Random method to generate random no and compare with constants to check presence. Random random = new Random(); int checkIfPresent = random.Next(0, 3); // instatiating compute employee wage class and calling WorkHours method which returns no of hours according to employee's presence. ComputeEmployeeWage computeEmployeeWage = new ComputeEmployeeWage(); fullDayHour[workDayCount] = computeEmployeeWage.WorkHours(checkIfPresent, workDayCount); if (totalWorkingHours + fullDayHour[workDayCount] > employeeDetail.hoursPerMonth) { fullDayHour[workDayCount] = 0; } totalWorkingHours += fullDayHour[workDayCount]; totalDailyWage[workDayCount] = fullDayHour[workDayCount] * employeeDetail.wagePerHour; Console.WriteLine($"Total daily wage is for {workDayCount + 1} is {totalDailyWage[workDayCount]}"); workDayCount++; //.LogDebug("Successfully Calculated daily employee wage : Main()"); } monthlyWage = totalWorkingHours * employeeDetail.wagePerHour; nLog.LogDebug("Successfully calculated monthly employee wage: calculateMonthlyWage()"); Console.WriteLine("********************************************************************"); Console.WriteLine($"The monthly wage for employee of {employeeDetail.companyName} is {monthlyWage}"); return(monthlyWage); }