As a sales manager, you want to see how each of your staff members performed this year as compared to last year. For each staff member i, you are given their name (in the i-th element of names), their total sales for last year (in the i-th element of lastYearSales), and their total sales from the current year (in the i-th element of thisYearSales). From this data, produce a report that has one element for each person formatted as follows: the difference in sales, a space, and then that staff member's name. Here is a sample report output:
5 SAM
4 ALICE
4 BOB
-2 SUE
-18 ADAM
0 DAVE
0 FRED
0 XANDER
According to this data, SAM sold 5 more units this year than last year, and ADAM sold 18 less. The other thing to notice is how the report is sorted. At the top of the report is data for all staff whose performance has changed. These are sorted based on that staff member's change in sales, from largest gain down to largest drop. After this, list all the staff who had no change in sales. In the case of a tie in sales figures, sort the tied elements alphabetically by name. All names will be given uppercase only, with no spaces, and no name will occur more than once. Your return will have the same number of elements as there are staff in the input; return each line of the report as one element with no line breaks or extra spaces.
Return the sales change report for the given input, with formatting and sorting as specified. |