public int ComputeEmpWage(ComputeWage companyEmpWage) { int totalEmpHours = 0; int workingDays = 0; int empHours; int totalWagePerDay; int totalWagePerMonth = 0; while (totalEmpHours < companyEmpWage.maxHoursPerMonth && workingDays < companyEmpWage.numOfWorkingDays) { EmployeeWageComp empWageBuilder = new EmployeeWageComp(); empHours = empWageBuilder.GetWorkingHours(); if (totalEmpHours == 96) { empHours = 4; } if (empHours != 0) { workingDays++; totalEmpHours = empHours + totalEmpHours; totalWagePerDay = empHours * companyEmpWage.ratePerHours; totalWagePerMonth += totalWagePerDay; Console.WriteLine("Total Wage per Day.." + totalWagePerDay); } } return(totalWagePerMonth); }
static void Main(string[] args) { EmployeeWageComp empWageBuilder = new EmployeeWageComp(); empWageBuilder.AddCompanyEmpWage("Dmart", 20, 2, 20); empWageBuilder.AddCompanyEmpWage("Reliance", 15, 14, 40); empWageBuilder.ComputeEmpWage(); Console.WriteLine("Total wage for Dmart is: " + empWageBuilder.GetTotalWage("Dmart")); Console.ReadKey(); }