import tester.Tester; //Examples and tests for accounts and lists of accounts class Examples{ Examples(){} Acct chk1 = new Acct("JFK", "checking", 4000); Acct chk2 = new Acct("LBJ", "checking", 1000); Acct sav = new Acct("DDE", "savings", 2000); Acct credit = new Acct("RMN", "credit card", 3000); ILo mtloa = new MtLo(); ILo alist2 = new ConsLo(this.chk1, new ConsLo(this.chk2, this.mtloa)); ILo alist3 = new ConsLo(this.sav, this.alist2); // test the method same in the classes that implement ILoB boolean testSameAcct(Tester t){ return t.checkExpect( this.chk1.same(new Acct("JFK", "checking", 4000)), true) && t.checkExpect(this.chk1.same(this.chk2), false) && t.checkExpect(this.chk1.same(this.sav), false) ;} // test the method size in the classes that implement ILoB boolean testSizeAcct(Tester t){ return t.checkExpect(this.mtloa.size(), 0) && t.checkExpect(this.alist2.size(), 2) && t.checkExpect(this.alist3.size(), 3);} // test the method contains in the classes that implement ILoB boolean testContainsAcct(Tester t){ return t.checkExpect(this.mtloa.contains(this.chk1), false) && t.checkExpect(this.alist2.contains(this.sav), false) && t.checkExpect(this.alist3.contains(this.sav), true);} Book oms = new Book("Old Man and the Sea", "Hemingway", 1952); Book eos = new Book("Elements of Style", "EBW", 1927); Book htdp = new Book("HtDP", "MF", 2001); Book ll = new Book("Little Lisper", "MF", 1995); ILo mtlob = new MtLo(); ILo blist2 = new ConsLo(this.oms, new ConsLo(this.eos, this.mtlob)); ILo blist3 = new ConsLo(this.htdp, this.blist2); // test the method same in the classes that implement ILoB boolean testSameBook(Tester t){ return t.checkExpect( this.oms.same(new Book("Old Man and the Sea", "Hemingway", 1952)), true) && t.checkExpect(this.eos.same(this.htdp), false) && t.checkExpect(this.htdp.same(this.ll), false) ;} // test the method size in the classes that implement ILoB boolean testSizeBook(Tester t){ return t.checkExpect(this.mtlob.size(), 0) && t.checkExpect(this.blist2.size(), 2) && t.checkExpect(this.blist3.size(), 3);} // test the method contains in the classes that implement ILoB boolean testContainsBook(Tester t){ return t.checkExpect(this.mtlob.contains(this.htdp), false) && t.checkExpect(this.blist2.contains(this.htdp), false) && t.checkExpect(this.blist3.contains(this.htdp), true);} }