Exemplo n.º 1
0
        public CompanyRoster()
        {
            PayrollExecutive myExec = new PayrollExecutive(0);

            this.Allemployees.Add(myExec);

            //Create three devs
            PayrollDeveloper payrollDeveloper1 = new PayrollDeveloper(1);
            PayrollDeveloper payrollDeveloper2 = new PayrollDeveloper(2);
            PayrollDeveloper payrollDeveloper3 = new PayrollDeveloper(3);



            this.Allemployees.Add(payrollDeveloper1);
            this.Allemployees.Add(payrollDeveloper2);
            this.Allemployees.Add(payrollDeveloper3);



            //this.listOfAllEmployees.Add(new PayrollDeveloper());
            PayrollSales mySales = new PayrollSales(4);

            this.Allemployees.Add(mySales);

            //Add( new PayrollHourly())
            PayrollHourly myHourly1 = new PayrollHourly(5);
            PayrollHourly myHourly2 = new PayrollHourly(6);

            this.Allemployees.Add(myHourly1);
            this.Allemployees.Add(myHourly2);
        }
Exemplo n.º 2
0
        public void CalculatePay()
        {
            foreach (PayrollEmployee person in this.Allemployees)
            {
                if (person is PayrollDeveloper)
                {
                    Console.WriteLine("This employee is a developer with employeeID: " + person.EmployeeID + ", please enter their bonus amount: ");
                    string val      = Console.ReadLine();
                    double inputVal = double.Parse(val);

                    PayrollDeveloper myEmp = (PayrollDeveloper)person;
                    myEmp.RecieveBonus(inputVal);
                    myEmp.PayInsurance();
                }

                else if (person is PayrollExecutive)
                {
                    Console.WriteLine("This employee is an executive, please enter their bonus amount: ");
                    string           val      = Console.ReadLine();
                    double           inputVal = double.Parse(val);
                    PayrollExecutive myEmp    = (PayrollExecutive)person;
                    myEmp.RecieveBonus(inputVal);
                    myEmp.PayInsurance();
                }
                else if (person is PayrollSales)
                {
                    Console.WriteLine("This employee is salesman, please enter their bonus amount: ");
                    string       val      = Console.ReadLine();
                    double       inputVal = double.Parse(val);
                    PayrollSales myEmp    = (PayrollSales)person;
                    myEmp.GiveEmployeeBonus(inputVal);
                }
                else if (person is PayrollHourly)
                {
                    Console.WriteLine("This emplyee is hourly, please enter hours worked: ");
                    string val         = Console.ReadLine();
                    int    hoursWorked = int.Parse(val);

                    PayrollHourly myEmp = (PayrollHourly)person;
                    myEmp.SetHoursWorked(hoursWorked);
                    myEmp.SetHourlyRate(20);
                }



                person.SetPaycheckTotal();
            }

            Console.WriteLine("ALl Employees total will now be calculated which will take a moment to compute!!");
            System.Threading.Thread.Sleep(1000);
            Console.WriteLine("All employee data was entered... The total will now be calculated");
        }
Exemplo n.º 3
0
        public void PopulateEmployeeList(List <PayrollEmployee> employees)
        {
            PayrollSales payrollEmployeeWorker = new PayrollSales();

            payrollEmployeeWorker.lastName   = "Givens";
            payrollEmployeeWorker.firstName  = "Hannah";
            payrollEmployeeWorker.employeeId = 101;
            employees.Add(payrollEmployeeWorker);

            PayrollHourly payrollEmployeeHourly = new PayrollHourly();

            payrollEmployeeHourly.lastName   = "Whittle";
            payrollEmployeeHourly.firstName  = "Bennett";
            payrollEmployeeHourly.employeeId = 102;
            employees.Add(payrollEmployeeHourly);

            payrollEmployeeHourly            = new PayrollHourly();
            payrollEmployeeHourly.lastName   = "James";
            payrollEmployeeHourly.firstName  = "LeBron";
            payrollEmployeeHourly.employeeId = 108;
            employees.Add(payrollEmployeeHourly);

            PayrollDeveloper payrollEmployeeDeveloper = new PayrollDeveloper();

            payrollEmployeeDeveloper.lastName   = "Jobs";
            payrollEmployeeDeveloper.firstName  = "Steve";
            payrollEmployeeDeveloper.employeeId = 103;
            employees.Add(payrollEmployeeDeveloper);

            payrollEmployeeDeveloper            = new PayrollDeveloper();
            payrollEmployeeDeveloper.lastName   = "Ballmer";
            payrollEmployeeDeveloper.firstName  = "Steve";
            payrollEmployeeDeveloper.employeeId = 106;
            employees.Add(payrollEmployeeDeveloper);

            payrollEmployeeDeveloper            = new PayrollDeveloper();
            payrollEmployeeDeveloper.lastName   = "Wynn";
            payrollEmployeeDeveloper.firstName  = "Steve";
            payrollEmployeeDeveloper.employeeId = 107;
            employees.Add(payrollEmployeeDeveloper);

            PayrollExecutivese payrollEmployeeExecutivese = new PayrollExecutivese();

            payrollEmployeeExecutivese.lastName   = "Musk";
            payrollEmployeeExecutivese.firstName  = "Elon";
            payrollEmployeeExecutivese.employeeId = 104;
            employees.Add(payrollEmployeeExecutivese);
        }