

class FancyCashRegister extends CashRegister {

   private long totalRefunds;

   // constructor
   public FancyCashRegister() {
      super();          // calls constructor of CashRegister
      totalRefunds = 0;
   }

   // add a new behaviour for refunds
   public void refundItem (String item, long price) {
      totalRefunds += price;
      total -= price;
      
      // print the item here
      
      ShowMoney.print(-price, priceLength);
   }

   // override summarize so it also prints the total refunds given
   public void summarize () {
      System.out.print ("Refunds   ");
      ShowMoney.print (totalRefunds, priceLength);
      super.summarize();  // finishes with normal summarize
   }

}

      
