Пример #1
0
        public void addCompanyEmpWage(string company, int empRatePerHour, int numOfWorkingDays, int maxHoursPerMnth)
        {
            CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHour, numOfWorkingDays, maxHoursPerMnth);

            this.companyEmpWagesList.AddLast(companyEmpWage);
            this.companyToEmpWageMap.Add(company, companyEmpWage);
        }
Пример #2
0
        private int computeEmpWage(CompanyEmpWage companyEmpWage)
        {
            //variables
            int empHrs = 0, totalEmpHrs = 0, totalWorkingDays = 0;

            //computation
            while (totalEmpHrs <= companyEmpWage.maxHoursPerMonth && totalWorkingDays < companyEmpWage.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;
                Console.WriteLine("Days#: " + totalWorkingDays + " Emp Hrs : " + empHrs);
            }
            return(totalEmpHrs * companyEmpWage.empRatePerHour);
        }
Пример #3
0
        /// <summary>
        /// Wages the calculation.
        /// </summary>
        /// <param name="companyEmpWage">The company emp wage.</param>
        /// <returns></returns>
        private int WageCalculation(CompanyEmpWage companyEmpWage)
        {
            ///Variables
            int employeeHours     = 0;
            int totalWorkingHours = 0;
            int totalWorkingDays  = 0;
            int totalEmpHrs       = 0;

            ///Computation
            while (totalWorkingHours < companyEmpWage.maxWorkingHours && totalWorkingDays < companyEmpWage.maxWorkingDays)
            {
                totalWorkingDays++;
                Random random = new Random();
                switch (random.Next(0, 3))
                {
                case IS_FULL_TIME:
                    employeeHours = 8;
                    break;

                case IS_PART_TIME:
                    employeeHours = 4;
                    break;

                default:
                    employeeHours = 0;
                    break;
                }
                totalEmpHrs += employeeHours;
                Console.WriteLine("Day " + totalWorkingDays + " Employee Hours : " + employeeHours);
            }
            return(totalEmpHrs * companyEmpWage.empRatePerHour);
        }
Пример #4
0
        public int computeEmpWage(CompanyEmpWage companyEmpWage)
        {
            int empHrs = 0, totalEmpHrs = 0, totalWorkingDays = 0; //variables

            while (totalEmpHrs <= companyEmpWage.maxHoursPerMonth && totalWorkingDays < companyEmpWage.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;
                Console.WriteLine("Days" + totalWorkingDays + "EmpHrs : " + empHrs);
            }
            companyEmpWage.dailyWage = empHrs * companyEmpWage.empRatePerHour;
            companyEmpWage.TotalWageAlongWithDailyWage = totalEmpHrs * companyEmpWage.empRatePerHour + companyEmpWage.dailyWage;
            return(totalEmpHrs * companyEmpWage.empRatePerHour);
        }
Пример #5
0
        /// <summary>
        /// Adds the company to an Array List
        /// </summary>
        /// <param name="company">The company.</param>
        /// <param name="empRatePerHour">The emp rate per hour.</param>
        /// <param name="maxWorkingDays">The maximum working days.</param>
        /// <param name="maxWorkingHours">The maximum working hours.</param>
        public void AddCompany(string company, int empRatePerHour, int maxWorkingDays, int maxWorkingHours)
        {
            CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHour, maxWorkingDays, maxWorkingHours);

            this.companyEmpWageList.AddLast(companyEmpWage);
            this.companyEmpWageDict.Add(company, companyEmpWage);
        }
Пример #6
0
        public void AddCompanyEmpWage(string company, int empRatePerHour, int numOfWorkingDays, int maxHourPerMonth)
        {//body of interface member
            CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHour, numOfWorkingDays, maxHourPerMonth);

            this.companyEmpWageList.AddLast(companyEmpWage);
            this.companyToEmpWageMap.Add(company, companyEmpWage);
        }
Пример #7
0
        public int ComputeMonthlyWage(CompanyEmpWage company)
        {
            int    workingHours  = 0;
            int    workingDays   = 0;
            int    wagesPerMonth = 0;
            Random rand          = new Random();

            while (workingHours < company.maxWorkingHours && workingDays < company.maxWorkingDays)
            {
                int attendance  = rand.Next(0, 3);
                int hoursWorked = 0;
                switch (attendance)
                {
                case EMP_FULL_TIME:
                    workingDays += 1;
                    hoursWorked  = FULL_DAY_HOUR;
                    break;

                case EMP_PART_TIME:
                    workingDays += 1;
                    hoursWorked  = PART_TIME_HOUR;
                    break;

                default:
                    break;
                }                //end Switch

                workingHours  += hoursWorked;
                wagesPerMonth += (company.wagePerHour * workingHours);
            }            //end while
            return(wagesPerMonth);
        }
Пример #8
0
        public void AddCompany(string companyName, int wagePerHour, int maxWorkingDays, int maxWorkingHours)
        {
            CompanyEmpWage company = new CompanyEmpWage(companyName, wagePerHour, maxWorkingDays, maxWorkingHours);

            company.setDailyWage(this.ComputeDailyWage(company));
            company.setWagesPerMonth(this.ComputeMonthlyWage(company));
            companies.Add(company);
        }
        public int CalculateWage(CompanyEmpWage company)
        {
            Random random = new Random();
            int    empCheck = 0, empHrs = 0, totalHrs = 0, empWage = 0, totalEmpWage = 0, days = 0;

            while (totalHrs <= company.workHrs && days < company.workDays)
            {
                empCheck = random.Next(0, 2);
                if (empCheck == IS_FULL_TIME)
                {
                    empHrs    = 8;
                    totalHrs += empHrs;
                }
                else
                {
                    empHrs    = 4;
                    totalHrs += empHrs;
                }
                days += 1;
            }
            empWage       = totalHrs * company.empRate * company.workDays;
            totalEmpWage += empWage;
            return(totalEmpWage);
        }
Пример #10
0
 public int ComputeDailyWage(CompanyEmpWage company)
 {
     return(FULL_DAY_HOUR * company.wagePerHour);
 }
Пример #11
0
 public void AddCompany(CompanyEmpWage company)
 {
     company.setDailyWage(this.ComputeDailyWage(company));
     company.setWagesPerMonth(this.ComputeMonthlyWage(company));
     companies.Add(company);
 }