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.

Recommended Answers

All 2 Replies

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.

nice a very simple idea.

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.