21. [Exercise] Check your Results, and Sort Them by Total Amount Spent

Activity

  • You can get the answer from TotalSpentByCustomer.scala where it shows the code for getting the total amount spent by each customer

  • I have included my code PurchaseByCustomer.scala which shows my solution

But Wait! There's More!

  • Now sort your results by amount spent!

  • Review our sorted word count example - it's the same idea.

Exercise

  • Instead now sort the list starting with the customer with the largest amount of total purchase, which you can also sort by ascending or descending

  • I have included the sorting code inside PurchaseByCustomer.scala

Last updated