Hey all so I got a vending machine program and I'm having trouble with this last function to calculate and give back the change. I am passing by referance the number of quarters, dime and nickels in the machine, the amount of each inputted and the change, then calculating the number of each coin to give back based on the amount of change. The problem I'm having is that it correctly gives back the quarters and dimes but the nickels gives back all in the machine and I'm not sure why since it is the same for the other coins. anyone have any ideas why I'm getting this problem?
Looks like you're keeping track of how many coins to return in the returnQuarter, returnDime and returnNickel variables? You're printing out nickelCount which seems to be tracking the number of nickels left in the register?