Adam Boom

Greenhorn
+ Follow
since Sep 20, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Adam Boom

Norm Radder wrote:Also posted at: http://www.dreamincode.net/forums/topic/397188-cash-register-problems/



Ok? Thanks I guess. Not sure what that has to do with anything. Someone here might have different insight.
7 years ago
Hello everyone, new guy at java here. I have to make a cash register that prompts for prices of items, prompts for coupons, outputs number of items, number of coupons, money saved, subtotal, tax %, tax in $, and total. I also have to prompt for money received from customer, then break that money received down into $20's, $10's, $5's, $1's, $.25's, $.10's, $.05's, and $.01. I pretty much have all that done. It may not be the best program in the world, but hey, I'm new. My problem is at the very end of the program, when I have to output the CHANGE DUE to the customer. It has to be broken down like I said earlier into 20's, 10's, etc.. and only show relevant bills. So if the total is $9, customer gives $10, only $1 change should show under CHANGE DUE. Instead I'm getting all the bills with 0's next to them, and a 1 next to the actual $1.

Here is what the final output looks like for change due

------ *** CHANGE DUE *** ------
$20.00 - 0
$10.00 - 0
$5.00  - 0
$1.00  - 4
$0.25  - 2
$0.10  - 1
$0.05  - 0
$0.01  - 1

I need the ones with 0's to not showup in the console but I can't seem to figure it out. Here is my entire code
7 years ago