Example #1
0
        private int computeEmpWage(CompanyEmpWage companyEmpWage)
        {
            int empHrs           = 0;
            int totalEmpHrs      = 0;
            int totalWorkingDays = 0;
            int dailyWage;

            while (totalEmpHrs <= companyEmpWage.maxHoursPerMonth && totalWorkingDays < companyEmpWage.numofWorkingDays)
            {
                totalWorkingDays++;
                Random rand     = new Random();
                int    empCheck = rand.Next(0, 3);
                switch (empCheck)
                {
                case IS_PART_TIME:
                    empHrs = 4;
                    break;

                case IS_FULL_TIME:
                    empHrs = 8;
                    break;

                default:
                    empHrs = 0;
                    break;
                }
                dailyWage = empHrs * companyEmpWage.empRatePerHour;

                totalEmpHrs += empHrs;
                Console.WriteLine("Days:" + totalWorkingDays + " Emp Hrs " + empHrs + "dailywage: " + dailyWage);
            }
            return(totalEmpHrs * companyEmpWage.empRatePerHour);
        }
        private int computeEmpWage(CompanyEmpWage empWageObj)
        {
            int empHrs = 0, totalEmpHrs = 0, totalWorkingDays = 0;

            while (totalEmpHrs <= empWageObj.maxHoursPerMonth && totalWorkingDays <= empWageObj.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;
            }
            return(totalEmpHrs * empWageObj.empRatePerHour);
        }
Example #3
0
        public void addCompanyEmpWage(string company, int empRatePerHour, int numOfWorkingDays, int maxHoursPerMonth)
        {
            CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHour, numOfWorkingDays, maxHoursPerMonth);

            this.compEmpWageList.AddLast(companyEmpWage);
        }