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 2 of 2

Thread: Using Loops to find change (Monetary)

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Using Loops to find change (Monetary)

    Hello,

    Now I'm sure for anyone reading this, this is probably a very easy task to accomplish. For someone as inexperienced with Java as myself, it has proven quite difficult:

    use the Remainder operator (%) to tell Joe what exact change he has, example: for $12.35 you would have a ten, a toonie, a quarter, and a dime. This may require a loop within a loop and a little bit of problem solving to figure out!**

    The actual change value is $11.18. I know that this is obviously one ten dollar bill, a loonie, a dime, a nickel, and three pennies. My problem is that I have no idea what formulas and whatnot to put into the computer so that it outputs "Joe's Change: and then the different change types indivually. Please keep your answers as simple as possible, as I am REALLY new, and it will look pretty weird in my code if there's a fifty line super high level block of code I obviously didn't write

    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: Using Loops to find change (Monetary)

    We aren't going to write code for you, but we'll help you think through the problem.

    How do you know that the change is obviously what it is? A big part of programming is taking things that humans "just do" and thinking about the steps involved in the process.

    Pretend you have a really dumb friend who has no idea how to make change. Write out a list of instructions (in English, not in code) that your friend could follow to get the job done. Remember how dumb your friend is, so make sure the instructions are as short and simple as possible! When you have that written out, you'll have yourself an algorithm that you can start converting into 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!

Similar Threads

  1. Using FOR and WHILE loops to find average (DUE TONIGHT)
    By cbh793 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: March 1st, 2013, 08:56 PM
  2. change finder
    By Darksole in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 22nd, 2013, 07:35 PM
  3. change DATE
    By anis.laghaei in forum What's Wrong With My Code?
    Replies: 11
    Last Post: December 7th, 2012, 11:44 AM
  4. change Name
    By anis.laghaei in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 3rd, 2012, 05:40 PM
  5. Making change
    By Jerick in forum Algorithms & Recursion
    Replies: 3
    Last Post: October 7th, 2011, 06:49 PM