/* this java file illustrates the basic organization of classes that will
   be generated by P3.
*/

class basic {

   public static void main( String args[] ) {
      empcont   ec;
      empcursor all;
      empcursor moreall;
      empcursor some;
      empcont1  ec1;
      emp       obj;

      emp[] rawdata = {
                         new emp( 10000,60,"Biology","Akers, Mark" ),
                         new emp( 10070,22,"CompSci","Andrews, Kay" ),
                         new emp( 10020,21,"Biology","Alexander, Joe" ),
                         new emp( 10010,40,"Physics","Akin, Monica" ),
                         new emp( 10050,42,"Biology","Akerson, Suzanne" ),
                         new emp( 10040,53,"Astrono","Akerson, Mary" ),
                         new emp( 10060,61,"CompSci","Andrews, John" ),
                         new emp( 10030,23,"Biology","Akerson, Gwyn" )
                      };
      int i;

      ec = ec1 = new empcont1();
      all = new all( ec1 );
      moreall = new all( ec1 );
      some = new old( ec1 );

      System.out.println("original employee data\n");

      for (i=0; i<rawdata.length; i++) {
         all.insert(rawdata[i]);
         all.obj().print();
      }

      System.out.println("increment ages of all employees\n\n");

      for (obj = all.first(); all.more(); obj = all.next()) {
         obj.print();
         obj.birthday();
      }

      System.out.println("read again");
    
      for (all.first(); all.more(); all.next()) {
         all.obj().print();
      }

      System.out.println("print old emps and delete\n\n");

      for (some.first(); some.more(); some.next()) {
         some.obj().print();
         some.remove();
         for (moreall.first(); moreall.more(); moreall.next()) {
            System.out.print("   ");
            moreall.obj().print();
         }
      }

      System.out.println("print remaining emps\n\n");

      for (all.first(); all.more(); all.next()) {
         all.obj().print();
      }

      System.out.println("\n\nDone");
   }
} 

