English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need to create a program where my customer pays for an item. I would input how much owed and how much money was received. Then I would click the calculate button to display the change in label boxes. If the change would be $5.23, I would like $5 to appear in the dollar label box, . 20 in the dime label box and .03 in the pennies label box. I know taking the value and converting it to a single variable would output the dollar amount of 5 in the dollar label box. Its quarters, dimes, nickels,and pennies that stump me

please help thank you

2007-03-17 12:56:12 · 1 answers · asked by jm 3 in Computers & Internet Programming & Design

1 answers

It is simple arithmetic to perform on the REMAINDER values once you have removed the dollars.

First, find out how many quarters you can remove by dividing by 25. The whole number will give you the number of quarters, the REMAINDER is the amount that you have left.

With that REMAINDER, remove dimes in the exact same way. Then remove nickels and finally the last REMAINDER is the number of pennies.

Now, back to your studies.

2007-03-17 17:47:18 · answer #1 · answered by RGB_Mars 3 · 0 0

fedest.com, questions and answers