1 /**
2 This program tests the DataSet class.
3 */
4 public class DataSetTester
5 {
6 public static void main(String[] args)
7 {
8 DataSet bankData = new DataSet();
9
10 bankData.add(new BankAccount(0));
11 bankData.add(new BankAccount(10000));
12 bankData.add(new BankAccount(2000));
13
14 System.out.println("Average balance: " + bankData.getAverage());
15 System.out.println("Expected: 4000");
16 Measurable max = bankData.getMaximum();
17 System.out.println("Highest balance: " + max.getMeasure());
18 System.out.println("Expected: 10000");
19
20 DataSet coinData = new DataSet();
21
22 coinData.add(new Coin(0.25, "quarter"));
23 coinData.add(new Coin(0.1, "dime"));
24 coinData.add(new Coin(0.05, "nickel"));
25
26 System.out.println("Average coin value: " + coinData.getAverage());
27 System.out.println("Expected: 0.133");
28 max = coinData.getMaximum();
29 System.out.println("Highest coin value: " + max.getMeasure());
30 System.out.println("Expected: 0.25");
31 }
32 }