private int ComputeEmpWage(CompanyEmpWage companyEmpWage)
        {
            int empHrs = 0, totalEmpHrs = 0, totalWorkingDays = 0;

            while (totalEmpHrs < companyEmpWage.maxHoursPerMonth && totalWorkingDays < companyEmpWage.numOfWorkingDays)
            {
                totalWorkingDays++;

                Random random   = new Random();
                int    empCheck = random.Next(0, 3);                   // assigning Random value to the variable

                //USING SWITCH STATEMENT
                switch (empCheck)
                {
                case FullTime:
                    empHrs = 8;
                    break;

                case PartTime:
                    empHrs = 4;
                    break;

                default:
                    empHrs = 0;
                    break;
                }
                totalEmpHrs += empHrs; //calculting emp hours
                Console.WriteLine("Days: " + totalWorkingDays + " Emp Hours: " + empHrs);
            } //END of WHILE LOOP

            return(totalEmpHrs * companyEmpWage.empRatePerHours);
        }
Пример #2
0
        public void AddCompanyWage(string company, int empRatePerHour, int numOfWorkingDays, int maxNumOfHours, int empHrsFullTime, int empHrsPartTime)
        {
            CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHour, numOfWorkingDays, maxNumOfHours, empHrsFullTime, empHrsPartTime);

            companyEmpWageList.Add(companyEmpWage);
            companyEmpWageMap.Add(company, companyEmpWage);
        }
        public void addCompanyEmpWage(string company, int empRatePerHours, int numOfWorkingDays, int maxHrsPerMonth)
        {
            CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHours, numOfWorkingDays, maxHrsPerMonth);

            this.companyEmpWagesList.AddLast(companyEmpWage);
            this.companyToEmpWageMap.Add(company, companyEmpWage);
        }
    private int ComputeEmpWage(CompanyEmpWage companyEmpWage)
    {
        int emphours = 0, totalEmpHour = 0, totalWorkingDay = 0;

        while (totalEmpHour <= companyEmpWage.maxHourPerMonth && totalWorkingDay < companyEmpWage.noOfWorkingDays)
        {
            totalWorkingDay++;
            Random random   = new Random();
            int    empCheck = random.Next(0, 3);
            switch (empCheck)
            {
            case IS_PART_TIME:
                emphours = 4;
                break;

            case IS_FULL_TIME:
                emphours = 8;
                break;

            default:
                emphours = 0;
                break;
            }
            totalEmpHour += emphours;
            Console.WriteLine("Days:" + " " + totalWorkingDay + " " + "Emp Hours : " + emphours);
        }
        return(totalEmpHour * companyEmpWage.empRatePerHour);
    }
    public void AddCompanyWage(string company, int empRatePerHour, int noOfWorkingDay, int maxHourPerMonth)
    {
        CompanyEmpWage companyEmpWage = new CompanyEmpWage(company, empRatePerHour, noOfWorkingDay, maxHourPerMonth);

        this.companyEmpWageList.AddLast(companyEmpWage);
        this.companyToEmpWageMap.Add(company, companyEmpWage);
    }
        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);
        }
Пример #7
0
 public void ComputeWage()
 {
     for (int i = 0; i < companyEmpWageList.Count; i++)
     {
         CompanyEmpWage companyEmpWage = (CompanyEmpWage)companyEmpWageList[i];
         companyEmpWage.setTotalEmpWage(this.CalculateWage(companyEmpWage));
         Console.WriteLine(companyEmpWage);
     }
 }
Пример #8
0
        public int CalculateWage(CompanyEmpWage companyEmpWage)
        {
            Console.WriteLine("Welcome To Employee Wage Computation Program");

            //Variable
            int    totalEmpHrs      = 0;
            int    totalWorkingDays = 0;
            int    empHrs;
            int    empWage;
            int    totalEmpWage = 0;
            Random rand         = new Random();

            //Computation
            while (totalEmpHrs <= companyEmpWage.maxNumOfHours && totalWorkingDays <= companyEmpWage.numOfWorkingDays)
            {
                totalEmpHrs++;
                totalWorkingDays++;

                int workingTime = rand.Next(0, 2);
                switch (workingTime)
                {
                case IS_FULL_TIME:
                    empHrs = companyEmpWage.empHrsFullTime;
                    break;

                case IS_PART_TIME:
                    empHrs = companyEmpWage.empHrsPartTime;
                    break;

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

                totalEmpWage += empWage;
                Console.WriteLine(" Emp Daily Wage: " + empWage);
            }
            totalEmpWageList.Add(totalEmpWage);
            totalEmpWageMap.Add(companyEmpWage.company, totalEmpWage);

            return(totalEmpWage);
        }
Пример #9
0
 private int computeEmpWage(CompanyEmpWage companyEmpWage);