home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PASANS.ZIP / CH15_1A.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-04  |  3KB  |  111 lines

  1.                        (* Chapter 16 - Programming exercise 1 *)
  2. unit Supervsr;
  3.  
  4. interface
  5.  
  6. uses Person;
  7.  
  8. type
  9.    Supervisor = object(Person_ID)
  10.       Title : string[15];
  11.       constructor Init(In_Name   : string;
  12.                        In_Salary : integer;
  13.                        In_Title  : string);
  14.       procedure Display; virtual;
  15.    end;
  16.  
  17.    Programmer = object(Person_ID)
  18.       Language : string[25];
  19.       constructor Init(In_Name     : string;
  20.                        In_Salary   : integer;
  21.                        In_Language : string);
  22.       procedure Display; virtual;
  23.    end;
  24.  
  25.    Consultant = object(Person_ID)
  26.       Specialty : string[25];
  27.       constructor Init(In_Name      : string;
  28.                        In_Fee       : integer;
  29.                        In_Specialty : string);
  30.       procedure Display; virtual;
  31.    end;
  32.  
  33.    Secretary = object(Person_ID)
  34.       Shorthand : boolean;
  35.       typing_Speed : integer;
  36.       constructor Init(In_Name         : string;
  37.                        In_Salary       : integer;
  38.                        In_Shorthand    : boolean;
  39.                        In_TYping_Speed : integer);
  40.       procedure Display; virtual;
  41.    end;
  42.  
  43. implementation
  44.  
  45.    constructor Supervisor.Init(In_Name   : string;
  46.                                In_Salary : integer;
  47.                                In_Title  : string);
  48.    begin
  49.       Name := In_Name;
  50.       Salary := In_Salary;
  51.       Title := In_Title;
  52.    end;
  53.  
  54.    procedure Supervisor.Display;
  55.    begin
  56.       WriteLn(Name,' is the ',Title, ' and makes $', Salary,
  57.                    ' per month.');
  58.    end;
  59.  
  60.  
  61.    constructor Programmer.Init(In_Name     : string;
  62.                                In_Salary   : integer;
  63.                                In_Language : string);
  64.    begin
  65.       Name := In_Name;
  66.       Salary := In_Salary;
  67.       Language := In_Language;
  68.    end;
  69.  
  70.    procedure Programmer.Display;
  71.    begin
  72.       WriteLn(Name,' specializes in ',Language, ' and makes $', Salary,
  73.                    ' per month.');
  74.    end;
  75.  
  76.  
  77.    constructor Consultant.Init(In_Name      : string;
  78.                                In_Fee       : integer;
  79.                                In_Specialty : string);
  80.    begin
  81.       Name := In_Name;
  82.       Salary := In_Fee;
  83.       Specialty := In_Specialty;
  84.    end;
  85.  
  86.  
  87.    procedure Consultant.Display;
  88.    begin
  89.       WriteLn(Name,' specializes in ',Specialty, ' and his fee is $',
  90.                      Salary, ' per consulting month.');
  91.    end;
  92.  
  93.  
  94.    constructor Secretary.Init(In_Name         : string;
  95.                               In_Salary       : integer;
  96.                               In_Shorthand    : boolean;
  97.                               In_Typing_Speed : integer);
  98.    begin
  99.       Name := In_Name;
  100.       Salary := In_Salary;
  101.       Shorthand := In_Shorthand;
  102.       Typing_Speed := In_Typing_Speed;
  103.    end;
  104.  
  105.    procedure Secretary.Display;
  106.    begin
  107.       WriteLn(Name,' can type ',Typing_Speed, ' words per minute.');
  108.    end;
  109.  
  110. end.
  111.