Ejemplo n.º 1
0
        /// <summary>
        /// Computes the employee wage for each company
        /// </summary>
        /// <param name="companyEmpWage">The company emp wage.</param>
        /// <returns></returns>
        private int ComputeEmpWage(CompanyEmpWage companyEmpWage)
        {
            int empHrs = 0, totalWorkingDays = 0;
            int totalWorkingHrs = 0;

            while (totalWorkingHrs <= companyEmpWage.MAX_WORKING_HRS && totalWorkingDays <= companyEmpWage.MAX_WORKING_DAYS)
            {
                Random random   = new Random();
                int    empCheck = random.Next(3);
                totalWorkingDays++;
                switch (empCheck)
                {
                case IS_EMPLOYEE_FULL_TIME:
                    empHrs = 8;
                    break;

                case IS_EMPLOYEE_PART_TIME:
                    empHrs = 4;
                    break;

                default:
                    empHrs = 0;
                    break;
                }
                totalWorkingHrs += empHrs;
                //Prints total workingdays and totalworking hrs
                Console.WriteLine("Days: " + totalWorkingDays + " Total Employee hrs: " + totalWorkingHrs);
            }
            //Returns the employee wage
            return(totalWorkingHrs * companyEmpWage.WAGE_PER_HR);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method adds company details to list and hashmap
        /// </summary>
        public void AddCompanyEmpWage(string company, int WAGE_PER_HR, int MAX_WORKING_DAYS, int MAX_WORKING_HRS)
        {
            CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, WAGE_PER_HR, MAX_WORKING_DAYS, MAX_WORKING_HRS);

            this.companyEmpWageList.AddLast(companyEmpWage);
            this.companyToEmpWageMap.Add(company, companyEmpWage);
        }
        /// <summary>
        /// Adds the company emp wage.
        /// </summary>
        /// <param name="company">The company.</param>
        /// <param name="empRatePerHour">The emp rate per hour.</param>
        /// <param name="numOfWorkingDays">The number of working days.</param>
        /// <param name="maxHoursPerMonth">The maximum hours per month.</param>
        public void AddCompanyEmpWage(string company, int empRatePerHour, int numOfWorkingDays, int maxHoursPerMonth)
        {
            CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHour, numOfWorkingDays, maxHoursPerMonth);

            this.companyEmpWagesList.AddLast(companyEmpWage);
            this.companyToEmpWageMap.Add(company, companyEmpWage);
        }
        /// <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);
        }
Ejemplo n.º 5
0
        public int EmpWageCompute(CompanyEmpWage companyEmployeeWage)
        {
            int empHrs           = 0;
            int totalEmpHrs      = 0;
            int totalWorkingDays = 0;
            int empRatePerHour   = 20;

            while (totalEmpHrs <= companyEmployeeWage.maxHoursPerMonth && totalWorkingDays < companyEmployeeWage.numOfWorkingDays)
            {
                totalWorkingDays++;
                Random random     = new Random();
                int    checkShift = random.Next(0, 3);
                switch (checkShift)
                {
                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 : " + totalEmpHrs + " Daily Wage : " + empHrs * empRatePerHour);
            }
            return(totalEmpHrs * companyEmployeeWage.empRatePerHour);
        }