Atm Cash dispenser
843789Sep 16 2009 — edited Sep 17 2009Can anyone help create a java program that if i input an amount, the program divides it in the the category of $50,$20 and $10. The ATM only Dispenses $50,$20,$10
Example:
Enter an Amount: $180
the out put would be
3 = Fifty's
1 = Twenty
1 = ten
// is there a way that if i Input an amount of $180 the out put would be, ATM only dispenses an amount of 50,20 and 10.
// 3 = fifty
// 1 = twenty
// 1= tens
// i dont know what to do to make a function to create this out put
// This is the original code
// the out put of this original code if i input $180 is
// 3 fifty , there is an error here
// 9 twenty
// 18 ten
//
package Withdraw;
import java.io.*;
class Withdraw
{
public static void main(String[] args) throws Exception
{
System.out.println ("Please Enter an Amount to Withdraw");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
if(n>5000)
System.out.println("ATM Cash Limit exceeds.");
else
{
if(n<5000)
System.out.println(n/50+ " Fifty");
System.out.println(n/20+ " Twenty");
System.out.println(n/10+ " Ten");
}
}
}