I have attached my current source code to this message. It is in .java format.

Here is a brief description of my problem:

I have a program which accepts input for a Purchase Price, an Amount Tendered, and then displays the Change Due. Also, it must display the number of dollars, quarters, dimes, nickels, and pennies. The input is complete and I can calculate the Change Due, but I cannot figure out how to calculate each piece of change individually.

Note: The output is not in the code, but I know how to properly write it, so I won't need any help with output

Thanks in advance for any help:


Also, here is the look my application is to have:

Purchase Price: $ ________ (completed)
Amount Tendered: $ ________ (completed)

Your change is: $ ________ (completed)

__ one dollar bill (s)
__ quarter (s)
__ dimes (s)
__ nickel (s)
__ penn (y/ies)


Thank you for your business. Come back soon. (completed)

How come you prompt the user for amount in pennies?

Well as you can see in the problem message in the source code, it is required. This is a homework assignment, so I have to do what the instructor says. I hope that explanation helps.

So all you need to do is find out how to most efficiently give change?

How do you determine what combination of coins and bills to use in a store? All you have to do is put that reasoning into code.

Say you give $1.26 in change.
How many dollars is that?
When those are gone, how many quarters are there in the leftover amount?
etc. etc. etc.

It's not hard.

nested loops

recursive function would be my choice. Far cleaner.

I have to do the same basic problem. My prof. said to use integer division & modulus to find the amount for each coin in nested if loops. How to write it is the next big headache.

I have to do the same basic problem. My prof. said to use integer division & modulus to find the amount for each coin in nested if loops. How to write it is the next big headache.We're to specify if the coin is singular/plural also.

I tried working on this and this was my solution. Not very great maybe, i hope its of use to you