/// <summary> /// Computes the emp wage. /// </summary> /// <param name="companyEmpWage">The company emp wage.</param> /// <returns></returns> public int ComputeEmpWage(CompanyEmpWage companyEmpWage) { int totalEmpHours = 0; int workingDays = 0; int empHours = 0; int totalWagePerDay = 0; int totalWagePerMonth = 0; while (totalEmpHours < companyEmpWage.maxHoursPerMonth && workingDays < companyEmpWage.numOfWorkingDays) { EmpWageBuilder empWageBuilder = new EmpWageBuilder(); 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) { Console.WriteLine("Welcome to Employee Wage Program"); EmpWageBuilder empWageBuilder = new EmpWageBuilder(); empWageBuilder.addCompanyEmpWage("D'Mart", 20, 6, 10); empWageBuilder.addCompanyEmpWage("Reliance", 10, 4, 20); empWageBuilder.computeEmpWage(); Console.WriteLine("Total wage for DMart company : " + empWageBuilder.getTotalWage("D'Mart")); }
static void Main(string[] args) { //Welcome Message Console.WriteLine("============================================="); Console.WriteLine("Welcome to Employee Wage Computation Program"); Console.WriteLine("============================================="); // Declaring Objects for different companies EmpWageBuilder empWageBuilder = new EmpWageBuilder(); //Adding the Company Data empWageBuilder.AddCompanyEmpWage("Dmart", 20, 20, 100); empWageBuilder.AddCompanyEmpWage("Reliance", 15, 14, 130); //Compute the total Wage empWageBuilder.ComputeEmpWage(); Console.ReadKey(); }