//APS101 Assingment 2, Winter 2008 //Examples of using some of the methods and their expected outputs //MyDate class is given, here is how to use it: > MyDate d1 = new MyDate(2003,1,12) > MyDate d2 = new MyDate(2005,1,12) > d1 2003/1/12 > d2 2005/1/12 > d1.lte(d2) true > d1.gte(d1) true > d1.gte(d2) false > d2.gte(d1) true > ShoppingCart sp = new ShoppingCart("Electronics Online",new MyDate(2007,2,18)) > sp.getCartItems() "" > sp.addToCart("AA Battery", 10, 1.25) > sp.getCartItems() "AA Battery:10:1.25" > sp.addToCart("DVD player", 2, 89) > sp.getCartItems() "AA Battery:10:1.25,DVD player:2:89.0" > sp.addToCart("LCD TV", 1, 1200) > sp.getCartItems() "AA Battery:10:1.25,DVD player:2:89.0,LCD TV:1:1200.0" > sp.updateQuantity("DVD", 1) flase > sp.updateQuantity("DVD player", 1) true > sp.getCartItems() "AA Battery:10:1.25,DVD player:1:89.0,LCD TV:1:1200.0" > sp.removeFromCart("Remote control") false > sp.removeFromCart("DVD player") true > sp.getCartItems() "AA Battery:10:1.25,LCD TV:1:1200.0" > CreditCard cc = new CreditCard(1234, "John Depp", new MyDate(2007,10,1)) > cc //this calls toString method Number:1234 Owner:John Depp Expiry:2007/10/1 > cc.getTransactions() "" > cc.calcBalance() 0.0 > sp.purchase(cc) //purchasing the item in our shopping cart with this card (costs 10*1.25 + 1*1200.0= 1212.5) true > sp.getCartItems() "" > cc.getTransactions() "2007/2/18:Electronics Online:1212.5" > cc.calcBalance() 1212.5 > cc.purchase(new MyDate(2007,1,20),"grocery shop", 40.1) true > cc.getTransactions() "2007/2/18:Electronics Online:1212.5,2007/1/20:grocery shop:40.1" > cc.calcBalance() 1252.6 > cc.payBill(new MyDate(2009,1,1), 1000) > cc.getTransactions() "2007/2/18:Electronics Online:1212.5,2007/1/20:grocery shop:40.1,2009/1/1:BillPayment:-1000.0" > cc.calcBalance() //this is ok, if round off error happens. 252.5999999999999 > cc.genTransactionsRange(new MyDate(2004,1,1),new MyDate(2006,2,18)) "No transaction found!" > cc.genTransactionsRange(new MyDate(2004,1,1),new MyDate(2007,2,18)) "2007/2/18:Electronics Online:1212.5,2007/1/20:grocery shop:40.1" > cc.genPaymentHistory(new MyDate(2009,1,1)) "Total:1000.0,2009/1/1:1000.0" > cc.genPaymentHistory(new MyDate(2009,1,2)) "No payment found!" >cc.biggestPurchase(new MyDate(2001,1,2)) "2007/2/18:Electronics Online:1212.5" > cc.refund(new MyDate(2007,3,3),"Electronic Online", 1212.5) //wrong name false > cc.refund(new MyDate(2006,3,3),"Electronics Online", 1212.5) //no purchase before! false > cc.getTransactions() //no change, as no refund proccessed "2007/2/18:Electronics Online:1212.5,2007/1/20:grocery shop:40.1,2009/1/1:BillPayment:-1000.0" > cc.refund(new MyDate(2007,3,3),"Electronics Online", 1212.5) //ok true > cc.getTransactions() //refund is there now "2007/2/18:Electronics Online:1212.5,2007/1/20:grocery shop:40.1,2009/1/1:BillPayment:-1000.0,2007/3/3:Electronics Online:-1212.5" > cc.calcBalance() //again round off error, but it's ok -959.9000000000001 //despite we refunded the elecronic purchase, since we don't remove transactions, //it's still the highest purchase (technically we ignore refunds here). >>cc.biggestPurchase(new MyDate(2001,1,2)) "2007/2/18:Electronics Online:1212.5"