I suggest setting up an array of objects to represent your "used money bills" (and their counts). You can then execute a loop for each of those bills and calculate (a) how many of a given bill would be used and (b) what would be left after those bills were accounted for. Consider something like (pseudocode)
number of bills = amount / bill value, expressed as integer
amount left over = amount modulus bill value next bill
Edit: On, you edited in "without using an array?" If that also precludes a collection, sounds like you're going to get some repetitive code, but you can still do it.
Oh, so you can use an array. Go back to what I suggested, use a loop.
For each given bill (or coin) value in descending order, you want to know (a) how many times the value can be evenly divided into your amount and (b) how much of your amount would be remaining after those bills were accounted for.
That is literally the description of the loop and the contents thereof. Think about how would you code that.
I coded a small version of your program and plugged in an initial amount of 5352.18 and displayed the counts, output below.
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"