forked from AllenDowney/ThinkJavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWithdrawal.java
More file actions
47 lines (20 loc) · 851 Bytes
/
Withdrawal.java
File metadata and controls
47 lines (20 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
public class Withdrawal
{
public static void main(String[] args)
{
int withdrawal = 137;
int twenties = withdrawal/ 20;
System.out.println("Twenties: " + twenties);
int remainderTwenties = withdrawal - twenties * 20;
System.out.println("Left to Go: " + remainderTwenties);
int tens = remainderTwenties/ 10;
System.out.println("Tens: " + tens);
int remainderTens = withdrawal - twenties * 20 - tens * 10;
System.out.println("Left to Go: " + remainderTens);
int fives = remainderTens/ 5;
System.out.println("Fives:" + fives);
int remainderFives = withdrawal - twenties * 20 - tens * 10 - fives * 5;
System.out.println("Left to Go: " + remainderFives);
System.out.println("Ones:" + remainderFives);
}
}