// out: 700 public static double Test004(ITrunk trunk) { trunk.addAccount("ABC-001", Currency.HUF); trunk.addTransfer("ABC-001", Currency.HUF, 1000); trunk.addTransfer("ABC-001", Currency.HUF, -500); trunk.addTransfer("ABC-001", Currency.HUF, 200); return trunk.getAccountValue("ABC-001"); }
// out: 900 public static double Test005(ITrunk trunk) { trunk.addAccount("ABC-001", Currency.HUF); trunk.addAccount("QWE-002", Currency.HUF); trunk.addTransfer("ABC-001", Currency.HUF, 1000); trunk.addTransfer("QWE-002", Currency.HUF, 333); trunk.addTransfer("ABC-001", Currency.EUR, -2); trunk.addTransfer("ABC-001", Currency.CHF, 2); trunk.addTransfer("QWE-002", Currency.HUF, 111); return trunk.getAccountValue("ABC-001"); }
// out: 27500 public static double Test006(ITrunk trunk) { trunk.addAccount("ASD-000", Currency.HUF); trunk.addAccount("ABC-001", Currency.HUF); trunk.addAccount("QWE-002", Currency.HUF); // 550 * 50 = 27500 for (int i = 0; i < 50; i++) { trunk.addTransfer("ASD-000", Currency.EUR, rand.Next(10,1000)); trunk.addTransfer("ASD-000", Currency.GBP, rand.Next(10, 1000)); trunk.addTransfer("ASD-000", Currency.JPY, rand.Next(10, 1000)); trunk.addTransfer("ABC-001", Currency.CHF, 3); // 600 trunk.addTransfer("ASD-000", Currency.HUF, rand.Next(10, 1000)); trunk.addTransfer("QWE-002", Currency.HUF, rand.Next(10, 1000)); trunk.addTransfer("ABC-001", Currency.EUR, -2); // -500 trunk.addTransfer("ABC-001", Currency.GBP, 1.5); // 450 trunk.addTransfer("ASD-000", Currency.HUF, rand.Next(10, 1000)); trunk.addTransfer("QWE-002", Currency.HUF, rand.Next(10, 1000)); } return trunk.getAccountValue("ABC-001"); }
// out: 0 public static double Test003(ITrunk trunk) { return trunk.getAccountValue("NO001"); }