Guest User

Untitled

a guest
May 26th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. class Cashier {
  2. constructor(//string priceList, float startingMoney, float salesTax){
  3. //parse the csv priceList and store it as a nested json, where for each product key = sku, value =a json object of the products other properties
  4. //Store the other parameters in respective properties
  5. //Initialize a boolean inTransaction property to false.
  6. //Initialize a transactions object where the key is transaction id, and values
  7. //are a csv string of transacition details
  8. }
  9.  
  10. function viewBalance() {
  11. //if the register is not currently involved in a transaction, return the amount of money currently in the register
  12. }
  13.  
  14. function startTransaction(//object customer) {
  15. //set inTransaction to true
  16. //instantiate a new transaction with a unique id, and the customer passed in as a parameter
  17. //set the customer's 'currentTransaction' property to the transaction object
  18. }
  19.  
  20. function scanItem(//string sku, object transaction) {
  21. //add the product corresponding to the sku to the transaction's 'products' array
  22. //incriment the transaction's 'total' propery by the product's price
  23. }
  24.  
  25. function closeTransaction(//float cashTendered, object transaction) {
  26. //set inTransaction to false
  27. //determine the amount of change to give to the customer
  28. //add the transaction to the 'transactions' object
  29. //set the customer's 'currentTransaction' property to null
  30. //display to the customer a list of products purchased and their grand totas
  31. }
  32.  
  33. funcation viewTransactions() {
  34. //iterate over the Cashier's 'transactions' object, displaying imformation for each transaction
  35. }
  36.  
  37. funcation searchProducts() {
  38. //search the Cashier's 'transaction's object for specific products
  39. }
  40.  
  41.  
  42. }
  43.  
  44. class Customer {
  45. constructor() {
  46. //initialize a currentTransaction property to null
  47. }
  48.  
  49. function seeCurrentTotal() {
  50. //returns the 'total' property of the customer's 'currentTransaction' if there is one
  51. }
  52.  
  53. function seeLastScannes() {
  54. //returns th last element of the 'products' array of the customer's 'currentTransaction' if there is one
  55. }
  56.  
  57. function findChange(//float cashAmount) {
  58. //return how much change the customer will recieve if they pay cashAmount for their 'currentTransaction'
  59. }
  60.  
  61. }
  62.  
  63. class Transaction {
  64. constructor(//int id, object customer) {
  65. //set the transaction's id and customer properties to the passes in parameters
  66. //initialize a timestamp property to the current date/time
  67. //initialize an empty array 'products' to track the products in the transaction
  68. //initialize a 'total' property to 0 that tracks the cash amount of this transaction
  69. }
  70. }
Add Comment
Please, Sign In to add comment