I would really appreciate it if someone could help me with a problem i am facing, because seriously its driving me crazy, its the first time i am having such a problem.
this is the code i ve written http://codepad.org/7Bv5gMzM
My problem is as follows (withdraw part) : (i am using eclipse btw)
If i want to withdraw any amount that combines euro coins and fifty cent coins, or just euro or fifty coins, its all good.
But when i try to withdraw amounts such as 1.65 which requires all 4 types of coins or at least 3 types, it doesnt occur
If the coins in the piggybank is of 10 and 5 cent and try to withdraw the same amount it wont work at all.
actually when it comes to 5 and 10 cent... it will withdraw up to 0.20 cent if its 10 cent and up to 0.10 cent if its 5 cent
and also if its a combination of the two, 0.15 for example it wont work again.
It doesnt make sense though, because is the same logic i used for the fifty cent coins and it works perfectly and
on top of that why does it work up to a certain point only?
I dont have any comments on that section of the program yet, so here some tips.
1. the problem is on the "withdrawdetails" function. code line 215-310 (thats for the funtion) and code lines 254-266 (for the problem)
2.the variables "euro,fifty,ten,five" are for the counting of each coin that will be withdrawn
3.the variables "valideuro,validfifty,validten,validfive,validwithdraw", store the total amount of each coin type
(temporary, just in case the transaction cannot occur, you will understand why once you see the code)
4. the variable "withdrawal" is the amount of money the user wants to withdraw.