-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank.java
More file actions
46 lines (38 loc) · 698 Bytes
/
Copy pathBank.java
File metadata and controls
46 lines (38 loc) · 698 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
public class Bank
{
private double[] accounts;
private final int NUM_ACCOUNTS = 10;
public Bank()
{
accounts = new double[NUM_ACCOUNTS];
for(int i = 0; i < NUM_ACCOUNTS; i++)
{
accounts[i] = 500;
}
}
public void printBalances()
{
for(double balance: accounts)
{
System.out.println(balance);
}
}
public void resizeAccounts()
{
accounts = new double[2 * NUM_ACCOUNTS];
}
public static void main(String[] args)
{
int[] pins, needles;
pins = new int[5];
needles = new int[5];
for (int i = 0; i < 5; i++)
{
needles[i] = pins[i];
}
Bank boa = new Bank();
boa.printBalances();
boa.resizeAccounts();
boa.printBalances();
}
}