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); }
static void Main(string[] args) { ArrayEmp ar = new ArrayEmp(); ar.ArrayEmployee(); EmployeeInput ei = new EmployeeInput(); ei.EmployeeIn(); Console.ReadLine(); }