1

We have given an individual assignment about a simple atm program which withdraw and check balance, sounds simple? here's the twist, the atm database have money inside with denominations 1,000bill, 500bill and 100bill ,20 pieces each , so once the user withdraw cash, it should output how many 1000,500,100 bill the user receives and should be deducted in the money inside the program in each denomination.

Because this is an individual assignment , I'm hesitating to post my code here just to avoid being copied.you don't have to post a code ,just your ideas and hint will be gladly appreciated.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Shizuo
0

You could simply declare/initialize four integers to hold the number of bills for each. Divide the withdrawal amount by 1000 (int / int to remove the remainder), and subtract the result from the number of thousands. Then subtract the result multiplied by 1000 from the withdrawal amount. One thing you'll need to consider: after getting the result, check it against the number of remaining bills and adjust accordingly. Then just go through the list of remaining bills.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.