aspose file tools*
The moose likes Beginning Java and the fly likes Need help for logic implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help for logic implementation" Watch "Need help for logic implementation" New topic
Author

Need help for logic implementation

mehuls patel
Greenhorn

Joined: May 06, 2013
Posts: 2
Not required
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8404
    
  23

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

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40034
    
  28
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

Joined: May 06, 2013
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

Joined: Oct 13, 2005
Posts: 40034
    
  28
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help for logic implementation