public int EmployeeWageComputation(CompanyEmpWage empwage) { int monthlySalary = 0; int totalWorkingHrs = 0; int totalWorkingDays = 0; int empHrs = 0; Random random = new Random(); while (totalWorkingHrs <= empwage.maxWorkingHrs && totalWorkingDays < empwage.noOfWorkingDays) { totalWorkingDays++; int empCheck = random.Next(0, 3); switch (empCheck) { case IS_FULL_TIME: empHrs = 8; break; case IS_PART_TIME: empHrs = 4; break; default: empHrs = 0; break; } totalWorkingHrs += empHrs; Console.WriteLine("Working day: " + totalWorkingDays + " Working Hours: " + empHrs + " Daily wage: " + empHrs * empwage.empRatePerHr); } monthlySalary = totalWorkingHrs * empwage.empRatePerHr; return(monthlySalary); }
private int computeEmpWage(CompanyEmpWage companyEmpWage) { int countOfHours = 0; int countOfDays = 0; int totalWage = 0; Random random = new Random(); int isFullOrPartTime; int empHours = 0; while (countOfHours <= companyEmpWage.totalHours && countOfDays < companyEmpWage.totalDays) { isFullOrPartTime = random.Next(0, 3); switch (isFullOrPartTime) { case FULLTIME: empHours = 8; break; case PARTTIME: empHours = 4; break; case ABSENT: empHours = 0; break; } totalWage = totalWage + (empHours * companyEmpWage.empRatePerHour); countOfHours += empHours; countOfDays += 1; } return(totalWage); }
public void AddCompanyEmpWage(string company, int empRatePerHr, int noOfWorkingDays, int maxWorkingHrs) { CompanyEmpWage companyemployeewage = new CompanyEmpWage(company, empRatePerHr, noOfWorkingDays, maxWorkingHrs); this.companyEmpWageList.AddLast(companyemployeewage); this.companyEmpWageMap.Add(company, companyemployeewage); }
private int ComputeEmpWage(CompanyEmpWage company) { int numOfWorkingDays = company.noOfWorkingDays; int maxHrsInMonth = company.maxHrsInMonth; string companyName = company.companyName; int empRatePerHour = company.empRatePerHour; //Variables int totalEmpHrs = 0; int totalWorkingDays = 0; Console.WriteLine("Company : " + companyName); while (totalEmpHrs <= maxHrsInMonth && totalWorkingDays < numOfWorkingDays) { totalWorkingDays++; //Computation int empHrs = EmpHrs(); totalEmpHrs += empHrs; int dailyWage = empHrs * empRatePerHour; company.StoreDailyEmpWage(totalWorkingDays, dailyWage); Console.WriteLine("Day#: " + totalWorkingDays + " Emp Hrs : " + empHrs); } int totalEmpWage = totalEmpHrs * empRatePerHour; Console.WriteLine("Total Emp Wage : " + totalEmpWage + " for Company : " + company.companyName + "\n"); nLog.LogInfo("Total Emp Wage : " + totalEmpWage + " for Company : " + company.companyName); return(totalEmpWage); }
public void AddCompanyEmpWage(string company, int empRatePerHr, int noOfWorkingDays, int maxWorkingHrs) { CompanyEmpWage c = new CompanyEmpWage(company, empRatePerHr, noOfWorkingDays, maxWorkingHrs); CompanyEmpWageList.Insert(noOfCompanies, c); noOfCompanies++; }
public int computeEmpWage(CompanyEmpWage companyEmpWage) { int empHrs = 0, totalEmpHrs = 0, totalWorkingDays = 0; while (totalEmpHrs <= companyEmpWage.maxHoursPerMonth && totalWorkingDays < companyEmpWage.numOfWorkingDays) { totalWorkingDays++; Random random = new Random(); int empCheck = random.Next(0, 3); switch (empCheck) { case IS_PART_TIME: empHrs = 4; break; case IS_FULL_TIME: empHrs = 8; break; default: empHrs = 0; break; } totalEmpHrs += empHrs; Console.WriteLine("Days" + totalWorkingDays + "EmpHrs : " + empHrs); } return(totalEmpHrs * companyEmpWage.empRatePerHour); }
/// <summary> /// Computes the employee wage. /// </summary> /// <param name="companyEmployeeWage">The company employee wage.</param> /// <returns></returns> public int ComputeEmpWage(CompanyEmpWage companyEmployeeWage) { //Variable int employeeHours = 0; int totalEmployeeHours = 0; int totalWorkingDays = 0; //While checks for the employee conditions while (totalEmployeeHours < companyEmployeeWage.maxHrsInMonth && totalWorkingDays < companyEmployeeWage.numberOfWorkingDays) { //Create reference of random class Random random = new Random(); //increments the working days totalWorkingDays++; //Switchcase to check fulltime and part time. switch (random.Next(0, 3)) { case IS_EMPLOYEE_FULL_TIME: employeeHours = 8; break; case IS_EMPLOYEE_PART_TIME: employeeHours = 4; break; default: employeeHours = 0; break; } //Assigns employee hours to total employee hour. totalEmployeeHours += employeeHours; } //Calculates employee wage and returns it. return(totalEmployeeHours * companyEmployeeWage.employeeRatePerHour); }
public void addCompanyEmpWage(string company, int empRatePerHour, int numOfWorkingDays, int maxHoursPerMonth) { CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHour, numOfWorkingDays, maxHoursPerMonth); this.companyEmpWageList.AddLast(companyEmpWage); this.companyToEmpWageMap.Add(company, companyEmpWage); }
public void ComputeEmpWage() { for (int i = 0; i < noOfCompanies; i++) { CompanyEmpWage c = (CompanyEmpWage)CompanyEmpWageList[i]; c.SetTotalEmpWage(this.EmployeeWageComputation(c)); Console.WriteLine(c.Display()); } }
public void AddCompanyEmpWage(string companyName, int workDays, int maxHrs, int empRate) { CompanyEmpWage objComEmpWage = new CompanyEmpWage(companyName, workDays, maxHrs, empRate); comEmpWageList.Add(objComEmpWage); }