Java implementation of Checkout exercise