Each instance of the CashRegister type keeps its own stored payment and purchase amounts.
To call an CashRegister instance method requires a CashRegister instance.
The dot operator is required:
CashRegister register = new CashRegister();
register.recordPurchase(29.50);
^ ^
| |
CashRegister CashRegister
instance instance method