
public class Phones {

   public static void main (String[] args) {
      Clock k = new WristWatch ("PhilipWatch");
      System.out.println (((WristWatch)k).brand 
         + "\t" + k.currentTime());
      CellPhone m = new CellPhone ("+372-25612345");
      System.out.println (String.valueOf (m.number)
         + "\t" + m.currentTime());
   }
}

interface TimeShowable {
   String currentTime();
}

class Clock implements TimeShowable {

   public String currentTime() {
      return java.util.Calendar.getInstance().getTime().toString();
   }
}

class WristWatch extends Clock {
   String brand;
   WristWatch (String s) {
      brand = s;
   }
}

class Phone {
   String number;
   Phone (String n) {
      number = n;
   }
}

class CellPhone extends Phone implements TimeShowable {
   private Clock innerClock;
   CellPhone (String n) {
      super (n);
      innerClock = new Clock();
   }
   public String currentTime() {
      return innerClock.currentTime();
   }
}

