I have to write a program for computer science that takes in the total amount of goods your buying and what amount your paying with and then outputs how much change you will receive. So for example your buying something for $3.99 and you have a $5 bill then it should output "1 loonie and 1 penny".
I have no idea how to do it. I tried using modulus division but I just ended up getting even more confused.
I don't want the program I just need to know how to do it.
Thanks in advance.

Please post your code, as you are probably on the right track. Think of how you would do it in life. Change is 1.01, how many dollars? 1. Remaining change 0.01. How many quarters? 0. dimes? 0. nickels? 0, pennies? 1. Remaining change, 0.00. What would happen if the change were 0.41?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.