Bleep Bleep Instructions Misleading


#1

The Bleep Bleep instructions state:

Then use the new method to void the last item we scanned. Finally, scan only 3 of the same item instead.

However, that's not what's happening. The voidLastTransaction() function only voids one item, so you're not scanning "only 3 of the same item instead", you're scanning 4, removing the last one, and scanning 3 more for a total of 6.

I can understand why it's simplest for teaching purposes to only undo the last transaction rather than an entire scan group, but the instruction wording should make that clear.


#2

IF the last transaction was 4 chocolate, then voiding will remove all 4 (namely the chocolate entry is voided). Scan 3 chocolate after voiding.


#3

Ok, now I understand why I misunderstood.

The cashRegister.add() function was initially intended to add the cost of an individual item. That's why its parameter is named "itemCost". When we were asked in the previous lesson to modify cashRegister.scan() to handle a quantity, my first approach was to call the add() method multiple times rather than multiplying by the quantity passed to add. However, the lesson instead forced us to multiply the item cost times the quantity and pass that into add(). I was still thinking of the add() method as applying to an individual item.

So yes, lastTransactionCost will be set to the cost of the scan group. It would be more consistent then to rename the parameter "itemCost" to something like "transactionCost".