//*******************************************************************
//
//   Words.java          In Text          Application
//
//   Authors:  Lewis and Loftus
//
//   Classes:  Words
//             Book
//             Dictionary
//
//*******************************************************************


//-------------------------------------------------------------------
//
//  Class Words contains the driver of a program that demonstrates
//  basic inheritance.
//
//  Methods:
//
//     public static void main (String[] args)
//
//-------------------------------------------------------------------

class Words {

   //===========================================================
   //  Instantiates a derived class and invokes its inherited
   //  and local methods.
   //===========================================================
   public static void main (String[] args) {

      Dictionary webster = new Dictionary ();

      webster.page_message();
      webster.definition_message();

   }  // method main

}  // class Words

//-------------------------------------------------------------------
//
//  Class Book serves as a parent class.
//
//  Methods:
//
//     public void page_message ()
//
//-------------------------------------------------------------------

class Book {

   protected int pages = 1500;

   //===========================================================
   //  Prints a message using the value of an instance
   //  variable.
   //===========================================================
   public void page_message () {

      System.out.println ("Number of pages: " + pages);

   }  // method page_message

}  // class Book

//-------------------------------------------------------------------
//
//  Class Dictionary inherits the methods and variables from the
//  parent class Book.
//
//  Methods:
//
//     public void definition_message ()
//
//-------------------------------------------------------------------

class Dictionary extends Book {

   private int definitions = 52500;

   //===========================================================
   //  Prints a message using values of an instance variable
   //  declared in this class and one that was inherited.
   //===========================================================
   public void definition_message () {

      System.out.println ("Number of definitions: " + definitions);
      System.out.println ("Definitions per page: " + definitions/pages);

   }  // method definition_message

}  // class Dictionary


