private static void FillEmployeeArray(Employee[] employees) { int count = 0; do { int typeIn = InputUtilities.getIntegerInputValue("Employee Type: 1: for Salaried 2: for Hourly: "); if (typeIn == 1) { employees[count] = new Salaried(); ApplicationUtilities.DisplayDivider("Enter the Employee Information"); EmployeeInput.CollectSalariedInformation((Salaried)employees[count]); EmployeeOutput.DisplayEmployeeInformation((Salaried)employees[count]); ApplicationUtilities.DisplayDivider("Enter Next Employees information"); count++; //Increment to next Index } else if (typeIn == 2) { employees[count] = new Hourly(); ApplicationUtilities.DisplayDivider("\n============ Enter the Employee Information ================\n"); EmployeeInput.CollectHourlyInformation((Hourly)employees[count]); EmployeeOutput.DisplayEmployeeInformation((Hourly)employees[count]); ApplicationUtilities.DisplayDivider("------Enter Next Employees information----------"); count++; //Increment to next Index } else { Console.WriteLine("Thats not a valid Employee Type. Please try again"); } } while (count < employees.Length); }
public static void CollectSalariedInformation(Salaried theSalariedEmp) { theSalariedEmp.FirstName = InputUtilities.getStringInputValue("First Name"); theSalariedEmp.LastName = InputUtilities.getStringInputValue("Last Name"); theSalariedEmp.Gender = InputUtilities.getCharInputValue("Gender"); theSalariedEmp.Dependents = InputUtilities.getIntegerInputValue("Dependents"); theSalariedEmp.AnnualSalary = InputUtilities.getDoubleInputValue("Annual Salary"); theSalariedEmp.ManagementLevel = InputUtilities.getIntegerInputValue("Management Level"); theSalariedEmp.Benefit.HealthInsuranceCompany = InputUtilities.getStringInputValue("Health Insurance Company"); theSalariedEmp.Benefit.LifeInsuranceAmount = InputUtilities.getDoubleInputValue("Ammount of Life Insurance"); theSalariedEmp.Benefit.VacationDays = InputUtilities.getIntegerInputValue("Number of Vacation Days"); }
public static void CollectHourlyInformation(Hourly theHourlyEmp) { theHourlyEmp.FirstName = InputUtilities.getStringInputValue("First Name"); theHourlyEmp.LastName = InputUtilities.getStringInputValue("Last Name"); theHourlyEmp.Gender = InputUtilities.getCharInputValue("Gender"); theHourlyEmp.Dependents = InputUtilities.getIntegerInputValue("Dependents"); theHourlyEmp.Wage = InputUtilities.getDoubleInputValue("Hourly Wage"); theHourlyEmp.Hours = InputUtilities.getDoubleInputValue("Hours Worked"); theHourlyEmp.Category = InputUtilities.getStringInputValue("Category: \n1 = temporary\n2 = part time\n3 = full time"); theHourlyEmp.Benefit.HealthInsuranceCompany = InputUtilities.getStringInputValue("Health Insurance Company"); theHourlyEmp.Benefit.LifeInsuranceAmount = InputUtilities.getDoubleInputValue("Ammount of Life Insurance"); theHourlyEmp.Benefit.VacationDays = InputUtilities.getIntegerInputValue("Number of Vacation Days"); }
static void Main(string[] args) { ApplicationUtilities.DisplayApplicationInformation(); //ApplicationUtilities.DisplayDivider("Please enter the emplyoyee information to be added"); string [] sampleEmployee = new string [10]; int count = 0; do { for (int samp = 0; samp < sampleEmployee.Length; samp++) { ApplicationUtilities.DisplayDivider("Please enter the emplyoyee information to be added"); Employee emp = new Employee(); emp.FirstName = InputUtilities.GetInput("First Name"); emp.LastName = InputUtilities.getStringInputValue("Last Name"); emp.Gender = InputUtilities.getCharInputValue("Gender"); emp.Dependents = InputUtilities.getIntegerInputValue("Number of dependents"); emp.AnnualSalary = InputUtilities.getDoubleInputValue("Annual Salary"); Console.WriteLine(emp.ToString()); emp.CalculateWeeklyPay(); Console.WriteLine("Weekly Pay: " + emp.CalculateWeeklyPay().ToString("C2")); count = samp++; Console.WriteLine("Number of employees: " + count++); } } while (count < 10); for (int samp = 0; samp < sampleEmployee.Length; samp++) { string newSamp = sampleEmployee[samp]; Console.Write(newSamp); } Console.WriteLine("\n*** There are " + Employee.NumEmployees + " Employee objects created***"); ApplicationUtilities.TerminateApplication(); }