Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CashRegister
- Properties
- PriceList Array of objects the individual objects the properties specified in the product class below
- MoneyReceived
- Last Item Scanned
- CurrentTransaction - Transaction
- PriorTransactions - Array of Transaction objects
- Current cash in the cash register - Money object
- InTransaction boolean
- CurrentTransactionID
- CurrentTransactionDateTime
- Methods
- Intialize(PriceList String, Money object, salestax number) {
- split the pricelist string on commas
- loop through the list three at a time and store them into product objects and push into array of pricelist
- }
- Total() {
- sum the total amounts in the cash register by calling total on the money object and return
- }
- StartTransaction() {
- InTransaction = true
- CurrentTransaction = new Transaction
- CurrentTransactionID++
- CurrentTransactionDateTime = now()
- }
- EndTransaction() {
- InTransaction = false
- PriorTransactions.push(CurrentTransaction)
- calculate total and return
- }
- ScanItem(SKU string) {
- CurrentTransaction.Add(CurrentTransactionID, TimeStamp, SKU)
- FindItem using SKU on pricelist
- Add Item to list and update quantity
- }
- Money - Class consisting of number bills of a particular type
- Properties
- cash array of money units
- Methods
- Total() {
- add up the array using value * quantity above and return total
- }
- Add(amounts) {
- take an array of amounts and matches to the cash array and subtracts the appropriate quantity from the corresponding index
- }
- Subtract(amounts) {
- figures out the least number of units that need to be substracted and subtracts from the corresponding index
- }
- MoneyUnit - Class contains a cash type and its value and the quantity
- Properties
- var cashtype = string
- var value = number
- var quantity = number
- PriceList - Class containing array of product objects
- Properties
- Array of Products
- Product - Class for objects stored in the price list on the cash register
- Properties
- Product Name
- SKU - Product ID
- Price per unit
- Taxable?
- Transaction
- Properties
- Transaction ID
- Time Stamp
- Scanned Products Array
- Cashier
- Customer
- Receipt
- Properties
- Product Name
- Number of items purchased
- Price
- Total
- Cashier Report
- Properties
- ID
- Number of items purchased
- Total
Add Comment
Please, Sign In to add comment