awesome-low-level-design icon indicating copy to clipboard operation
awesome-low-level-design copied to clipboard

vendingMachine.resetPayment(); should be after the if, else flow

Open subhajit100 opened this issue 8 months ago • 1 comments

The below line should be after the if, else flow, as it doesn't matter if the change to return is greater than 0 or not, we need to make the totalPayment to 0.0 again, for next transaction, as we are doing for selectedProduct after the if, else block.

https://github.com/ashishps1/awesome-low-level-design/blob/482e3faacab908dc8d5e8326c95cf9d410a0a53b/solutions/java/src/vendingmachine/ReturnChangeState.java#L35

subhajit100 avatar Feb 16 '25 18:02 subhajit100