Java program that calculates the optimum change to be returned in a transaction