1 /**
2 This program demonstrates the measurable BankAccount and Country classes.
3 */
4 public class MeasurableTester
5 {
6 public static void main(String[] args)
7 {
8 Measurable[] accounts = new Measurable[3];
9 accounts[0] = new BankAccount(0);
10 accounts[1] = new BankAccount(10000);
11 accounts[2] = new BankAccount(2000);
12
13 double averageBalance = Data.average(accounts);
14 System.out.println("Average balance: " + averageBalance);
15 System.out.println("Expected: 4000");
16
17 Measurable[] countries = new Measurable[3];
18 countries[0] = new Country("Uruguay", 176220);
19 countries[1] = new Country("Thailand", 513120);
20 countries[2] = new Country("Belgium", 30510);
21
22 double averageArea = Data.average(countries);
23 System.out.println("Average area: " + averageArea);
24 System.out.println("Expected: 239950");
25 }
26 }