Forums Register Login

Need help for logic implementation

+Pie Number of slices to send: Send
Not required
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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.





+Pie Number of slices to send: Send
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.
I am Arthur, King of the Britons. And this is a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 746 times.
Similar Threads
Addition of elements is taking less time in Vector when compared to ArrayList
car park pre-payment machine simulation
Loop/Array Logic
Laundrette
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:09:50.