Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Please help me out

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Please help me out

    public class MoneyTask {
    public static int countWaysToProduceGivenAmountOfMoney(int cents) {
            /*
              Please implement this method to
              return the number of different combinations of US coins
              (penny: 1c, nickel: 5c, dime: 10c, quarter: 25c, half-dollar: 50c)
              which may be used to produce a given amount of money.
     
              For example, 11 cents can be produced with
              one 10-cent coin and one 1-cent coin,
              two 5-cent coins and one 1-cent coin,
              one 5-cent coin and six 1-cent coins,
              or eleven 1-cent coins.
              So there are four unique ways to produce 11 cents.
              Assume that the cents parameter is always positive.
     
             */
    }
     
    }


    thanks in advance.

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Please help me out

    That's absolutely NOT how this works. Read the link in my signature on asking questions the smart way before you post again. Homework dumps will get you banned.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Please help me out

    i apologise kevin.atleast can i have a hint to proceed with it.
    thanks.

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Please help me out

    Hint: How would you do this by hand, or with a piece of paper and a pencil? Pretend you have a friend who has no idea how to make change. Write out instructions that he can follow, and you'll have an algorithm that should be pretty easy to translate to code.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. The Following User Says Thank You to KevinWorkman For This Useful Post:

    ravikiran (August 2nd, 2011)