Пример #1
0
        public static void run(string delimiter, EmployeePayrollEntry[] sortedEntries)
        {
            paycheckStrings = new string[sortedEntries.Length];

            for (int i = 0; i < sortedEntries.Length; i++)
            {
                EmployeePayrollEntry e = sortedEntries[i];
                string text            = e.Id;
                text += delimiter + " " + e.firstName;
                text += delimiter + " " + e.lastName;
                text += delimiter + " " + e.getPeriodGrossPay().ToString("F");
                text += delimiter + " " + e.getFederalTax().ToString("F");
                text += delimiter + " " + e.getStateTax().ToString("F");
                text += delimiter + " " + e.getNetPay().ToString("F");
                paycheckStrings[i] = text;
            }

            writePaychecksToFile();
        }
Пример #2
0
        public static List <TopEarnerModel> getSortedListGrossLastNameFirstName(EmployeePayrollEntry[] entries)
        {
            List <TopEarnerModel> topEarnerList = new List <TopEarnerModel>();

            for (int i = 0; i < entries.Length; i++)
            {
                EmployeePayrollEntry entry  = entries[i];
                TopEarnerModel       earner = new TopEarnerModel();
                earner.lastName       = entry.lastName;
                earner.firstName      = entry.firstName;
                earner.numYearsWorked = getNumYearsWorked(entry.startDate);
                earner.grossPay       = entry.getPeriodGrossPay();
                topEarnerList.Add(earner);
            }

            var top = topEarnerList.OrderBy(e => e.grossPay).
                      ThenBy(e => e.lastName).
                      ThenBy(e => e.firstName).
                      ToList();

            return(top);
        }