We all know how to withdraw money from ATM machine. When my friend was checking his account balance, first time I came to know about ATM machine, I wondered by looking at that machine (It was the Andhra Bank ATM at Kodad). Of course I didn't even know what is a computer at that time.
Have you ever thought about how the ATM machine is dispensing money? It's just a simple calculation happens to decide how the notes have to be withdrawn. That calculation program just looks like below. Of course it is very simple stand alone program and you can extend based on your requirements.
* This class will print the denomination of notes while withdrawing money from ATM.
* @author SANTHOSH REDDY MANDADI
* @version 1.0
* @since 20-Sep-2012
public class Withdraw
public static void main(String args) throws Exception
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("ATM Cash Limit exceeds.");
//System.out.println(n-500+" "+(n-500)/500+" "+(n-500)%500);
h += ((n-500)%500)/100;
System.out.println(f+" Five Hundreds and "+h+" Hundreds");
1 Five Hundreds and 5 Hundreds
1 Five Hundreds and 1 Hundreds
6 Five Hundreds and 2 Hundreds
If you've sometime, why don't you have a look at my Other Java programs.