//Calculating monthly wages for different companies
        public int ComputeEmpWage(EmpWageBuilder empWageBuilder)
        {
            int totalEmpHours     = 0;
            int days              = 0;
            int empHours          = 0;
            int totalWagePerDay   = 0;
            int totalWagePerMonth = 0;

            while (totalEmpHours < empWageBuilder.maxHours && days < empWageBuilder.workingDays)
            {
                EmpWageCalc empWageCalc = new EmpWageCalc();
                empHours = empWageCalc.GetWorkingHours();

                if (totalEmpHours == 96)
                {
                    empHours = 4;
                }
                if (empHours != 0)
                {
                    days++;
                    totalEmpHours      = empHours + totalEmpHours;
                    totalWagePerDay    = empHours * empWageBuilder.dWage;
                    totalWagePerMonth += totalWagePerDay;
                    Console.WriteLine("Total Wage per Day.." + totalWagePerDay);
                }
            }
            return(totalWagePerMonth);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            EmpWageCalc empWagecalc = new EmpWageCalc();

            empWagecalc.AddCompanyWage("Dmart", 20, 2, 20, 100);
            empWagecalc.AddCompanyWage("Reliance", 15, 14, 40, 90);
            empWagecalc.ComputeEmpWage();
            Console.WriteLine("Total wage for Dmart is: " + empWagecalc.GetTotalWage("Dmart"));
            Console.ReadKey();
        }