Guest User

Untitled

a guest
May 26th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. // The Cashinator 3000
  2.  
  3. // As a cashier, I can initialize the cash register with a price list in a simple comma - delimited format.The price list contains product names,
  4. // SKU's (stock-keeping units, i.e., the product id), the price per unit, and whether the product is taxable. (Staple groceries are typically not taxable.)
  5. // As a cashier, I can initialize the register with a starting amount of money.
  6. // As a cashier, I can initialize the register with a sales tax percentage.
  7. // As a cashier, when I am not actively handling a customer transaction, I can choose to view the current balance of cash that the register contains.
  8. // As a cashier, I can start a new transaction.Transactions have id's and are time-stamped upon creation.
  9. // As a cashier, I can scan one item, whereupon that item is added to the transaction.
  10. // As a customer, I can see the last item scanned and a running subtotal of the current transaction cost.
  11. // As a cashier, I can input the money received from the customer, thus closing out the transaction.
  12. // Change is calculated to minimize the number of bills and coins that must be handled by the cashier.
  13. // As a customer, I can see the grand total and how much change I am to receive.
  14. // As a customer, I can see an itemized receipt of my purchases.
  15. // As a cashier, I can view a report of all the transactions that have occurred since register initialization.Transactions are listed by id, # of items purchased, and the transaction amount.
  16. // As a cashier, I can search all items purchased since register initialization.I can do a partial string match on product name.
  17.  
  18. const cashRegister = function(startingAmt, startingTax) {
  19. // create priceList
  20. this.priceList = [];
  21. // define balance with given startingAmt or 0
  22. this.balance = startingAmt || 0;
  23. // define sales tax with given startingTax or 0
  24. this.salesTax = startingTax || 0;
  25. // perhaps define starting transaction here with SKU and price, and taxable field
  26. this.transactions = {'0': {items} }
  27. return;
  28. }
  29.  
  30.  
  31. // create viewBalance function, I can choose to view the current balance of cash that the register contains.
  32. cashRegister.prototype.viewBalance() {
  33. // return total balance
  34. return this.balance;
  35. }
  36.  
  37. // start new transaction function
  38. cashRegister.prototype.newTransaction() {
  39. // create ids for transactions
  40. // create timestasmp after created
  41. }
  42.  
  43. // check scanned and add item function, I can scan one item, whereupon that item is added to the transaction.
  44. cashRegister.prototype.scanItem(transactionId, item) {
  45. // takes in a transaction ID and item as parameters and search for that in cashRegister
  46. // add and push item into transaction according to transaction ID
  47. }
  48.  
  49. // check last scanned item
  50. cashRegister.prototype.lastScanned(transactionId) {
  51. // takes a transaction ID paramter and look for it in cash register
  52. // return item of that ID
  53. }
  54.  
  55. // create import money and close out transaction function
  56. cashRegister.prototype.importMoney(moneyAmt) {
  57. // find the matching ID and define money from customer?
  58.  
  59. }
  60.  
  61. // create grand total view function
  62. // Change is calculated to minimize the number of bills and coins that must be handled by the cashier.
  63. // As a customer, I can see the grand total and how much change I am to receive.
  64. cashRegister.prototype.grandTotal() {
  65.  
  66. }
  67.  
  68. // create itemized receipt function
  69. cashRegister.prototype.viewItemizedReceipt(transactionId) {
  70. // takes in transaction ID as paramter and look for the items by separating out items in the matching ID
  71. // iterate through items with for loop or forEach
  72. }
  73.  
  74. // create report transacctions since last regiser initialization function
  75. // As a cashier, I can view a report of all the transactions that have occurred since register initialization.
  76. // Transactions are listed by id, # of items purchased, and the transaction amount
  77. cashRegister.prototype.reportRegisteredTransactions() {
  78. // for each existing transaction in cash register, return/console.log transaction Id, # of items, and trans amt
  79. }
  80.  
  81. // create search purchased items function
  82. cashRegister.prototype.searchPurchasedItems(productName) {
  83. // iterate through existing transactions in cash register
  84. // if we find the matching product name, return true?
  85. }
Add Comment
Please, Sign In to add comment