Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!

# Need help for logic implementation

mehuls patel
Greenhorn
Posts: 2
Not required

Winston Gutkowski
Bartender
Posts: 10417
63
mehulalex patel wrote:how do I check the minimum and maximum capacity of each denomination.

Well, that would come from your enum, wouldn't it?

However, my main advice to you is to StopCoding (←click).

You've written (or been given) a pile of code, and you plainly don't understand how it works; so stop - NOW - sit back, and think.

Write out scenarios and work out how you would do it, and see how closely it comes to the code you've written. And don't be afraid to toss the whole lot in the bin if it's not right, because you will never code your way out of a mess.

Winston

Campbell Ritchie
Sheriff
Posts: 48981
60
Welcome to the Ranch
Have you been given any specifications for your cash machine? Please tell us. You should use them to work out whether there is any connection between the paying in methods and the taking out methods.

mehuls patel
Greenhorn
Posts: 2
Campbell Ritchie wrote:Welcome to the Ranch
Have you been given any specifications for your cash machine? Please tell us. You should use them to work out whether there is any connection between the paying in methods and the taking out methods.

no there is no relation between the paying and payout method.

my pay out method gives me out put as

10 * 163 = 1630
2 * 1 = 2
1 * 1 = 1

which is wrong because denomination 10 is exceeding its max limit ideally it should not go beyond 100.

below is the min/ max ,limit for each denominations

COIN1 (1, 5, 200), // 1 euro coins 5 is minimum limit and 200 is max limit.
COIN2 (2, 5, 150), // 2 euro coins 5 is minimum limit and 150 is max limit.
NOTE1 (5, 0, 120), // 5 euro notes 0 is minimum limit and 120 is max limit.
NOTE2 (10, 0, 100); // 10 euro notes 0 is minimum limit and 100 is max limit.

Campbell Ritchie
Sheriff
Posts: 48981
60
Go to the bank and get a large bag of mixed small coins. Count them out to make €16.30 or €1630 or whatever. How did you do it? Did you start with large coins or small? When you have done that, write down in very simple words how to do it. Now you can start to change that example into code.
You will probably have to turn your computer off while you are doing that exercise.