Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Data Manipulation
- * List a summary of all of the expensible items for an employee, sorted by purchaseDate and businessName.
- * If multiple expensible items were made at a businessName on the same purchaseDate, get the sum of the cost to list as the cost.
- *
- * Inputs:
- * You have two variables of string data type, of which each string is formatted as valid CSV.
- * The Categories variable provides the following information in order: categoryID, categoryName, and isExpensible
- * The Expenses variable provides the following information in order: businessName, purchaseDate, itemDescription, cost, and categoryID.
- *
- * Output:
- * Each line should be displayed using string formatting, as "purchaseDate: businessName - $cost", with one line for each appearing date, location combination.
- *
- *
- * The following is a tabular view of the inputs and the exact outputs expected.
- *
- * Categories:
- * CFE,Coffee,Y
- * FD,Food,Y
- * PRS,Personal,N
- *
- * Expenses:
- * Starbucks,3/10/2018,Iced Americano,4.28,CFE
- * Starbucks,3/10/2018,Nitro Cold Brew,3.17,CFE
- * Starbucks,3/10/2018,Souvineer Mug,8.19,PRS
- * Starbucks,3/11/2018,Nitro Cold Brew,3.17,CFE
- * High Point Market,3/11/2018,Iced Americano,2.75,CFE
- * High Point Market,3/11/2018,Pastry,2.00,FD
- * High Point Market,3/11/2018,Gift Card,10.00,PRS
- *
- * Results:
- * 3/10/2018: Starbucks - $7.45
- * 3/11/2018: High Point Market - $4.75
- * 3/11/2018: Starbucks - $3.17
- */
- // Input Values
- var categories = "CFE,Coffee,Y\nFD,Food,Y\nPRS,Personal,N";
- 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