Пример #1
0
        public int ComputeEmpWage(CompanyEmpWage companyEmpWage)
        {
            int    empHrs = 0, empWage, totalEmpHours = 0, totalWorkingDays = 0;
            Random random = new Random();

            while (totalWorkingDays < companyEmpWage.numOfWorkingDays && totalEmpHours < companyEmpWage.maxHoursPerMonth)
            {
                totalWorkingDays++;
                int empCheck = random.Next(0, 3);
                switch (empCheck)
                {
                case IS_FULL_TIME:
                    empHrs         = 8;
                    totalEmpHours += 8;
                    break;

                case IS_PART_TIME:
                    empHrs         = 4;
                    totalEmpHours += 4;
                    break;

                default:
                    empHrs = 0;
                    break;
                }
                Console.WriteLine("Day= " + totalWorkingDays + "  Wage= " + empHrs);
            }
            return(totalEmpHours * companyEmpWage.empRatePerHour);
        }
Пример #2
0
        public void AddCompanyEmpWage(string company, int empRatePerHour, int numOfWorkingDays, int maxHoursPerMonth)
        {
            CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHour, numOfWorkingDays, maxHoursPerMonth);

            companyEmpWageList.Add(companyEmpWage);
            companyEmpWageMap.Add(company, companyEmpWage);
        }
Пример #3
0
 public void ComputeEmpWage()
 {
     for (int i = 0; i < companyEmpWageList.Count; i++)
     {
         CompanyEmpWage company = companyEmpWageList[i];
         company.SetTotalEmpWage(this.ComputeEmpWage(company));
         Console.WriteLine(company.toString());
     }
 }