Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. /**
  2. * Data Manipulation
  3. * List a summary of all of the expensible items for an employee, sorted by purchaseDate and businessName.
  4. * If multiple expensible items were made at a businessName on the same purchaseDate, get the sum of the cost to list as the cost.
  5. *
  6. * Inputs:
  7. * You have two variables of string data type, of which each string is formatted as valid CSV.
  8. * The Categories variable provides the following information in order: categoryID, categoryName, and isExpensible
  9. * The Expenses variable provides the following information in order: businessName, purchaseDate, itemDescription, cost, and categoryID.
  10. *
  11. * Output:
  12. * Each line should be displayed using string formatting, as "purchaseDate: businessName - $cost", with one line for each appearing date, location combination.
  13. *
  14. *
  15. * The following is a tabular view of the inputs and the exact outputs expected.
  16. *
  17. * Categories:
  18. * CFE,Coffee,Y
  19. * FD,Food,Y
  20. * PRS,Personal,N
  21. *
  22. * Expenses:
  23. * Starbucks,3/10/2018,Iced Americano,4.28,CFE
  24. * Starbucks,3/10/2018,Nitro Cold Brew,3.17,CFE
  25. * Starbucks,3/10/2018,Souvineer Mug,8.19,PRS
  26. * Starbucks,3/11/2018,Nitro Cold Brew,3.17,CFE
  27. * High Point Market,3/11/2018,Iced Americano,2.75,CFE
  28. * High Point Market,3/11/2018,Pastry,2.00,FD
  29. * High Point Market,3/11/2018,Gift Card,10.00,PRS
  30. *
  31. * Results:
  32. * 3/10/2018: Starbucks - $7.45
  33. * 3/11/2018: High Point Market - $4.75
  34. * 3/11/2018: Starbucks - $3.17
  35. */
  36.  
  37. // Input Values
  38. var categories = "CFE,Coffee,Y\nFD,Food,Y\nPRS,Personal,N";
  39. var expenses = "Starbucks,3/10/2018,Iced Americano,4.28,CFE\nStarbucks,3/10/2018,Nitro Cold Brew,3.17,CFE\nStarbucks,3/10/2018,Souvineer Mug,8.19,PRS\nStarbucks,3/11/2018,Nitro Cold Brew,3.17,CFE\nHigh Point Market,3/11/2018,Iced Americano,2.75,CFE\nHigh Point Market,3/11/2018,Pastry,2.00,FD\nHigh Point Market,3/11/2018,Gift Card,10.00,PRS";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement