Â
import java.util.Scanner; public class CashPoint { public static void main(String[] args){ Scanner Scan = new Scanner(System.in); int note50 = 0; int note20 = 0; int note10 = 0; int note5 = 0; System.out.print("Enter amount: "); int amount = Scan.nextInt(); if (amount < 5){ System.out.println ("The amount is too small."); }else{ if (amount > 250){ System.out.println ("The amount exceeds the daily limit of withdrawals."); }else{ if (amount >=50){ note50 = amount/50; amount = amount - note50 * 50; } if (amount >=20){ note20 = amount/20; amount = amount - note20 *20; } if (amount >=10){ note10 = amount/10; amount = amount - note10 * 10; } if (amount >=5){ note5 = amount/5; amount = amount - note5 * 5; } System.out.println("Notes given out are: "); System.out.println("£50 = " + note50); System.out.println("£20 = " + note20); System.out.println("£10 = " + note10); System.out.println("£5 = " + note5); } } } }
£50 = 4 £20 = 1 £10 = 1 £5 = 1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)