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

  1.                                      (* Chapter 14 - Program 6 *)
  2. program Inheritance_2;
  3.  
  4. uses vehicles, CarTruck;
  5.  
  6. { ************************ main program ************************** }
  7.  
  8. var Unicycle : Vehicle;
  9.     Sedan    : Car;
  10.     Semi     : Truck;
  11.  
  12. begin
  13.  
  14.    Unicycle.Init(1, 12.0);
  15.    Sedan.Init(4, 2100.0, 5);
  16.    Semi.Init(1, 25000.0, 18, 5000.0);
  17.  
  18.    WriteLn('The unicycle weighs ', Unicycle.Get_Weight:5:1,
  19.            ' pounds, and has ', Unicycle.Get_Wheels, ' wheel.');
  20.  
  21.    WriteLn('The car weighs ', Sedan.Get_Weight:7:1,
  22.            ' pounds, and carries ', Sedan.Passengers,
  23.            ' passengers.');
  24.  
  25.    WriteLn('The semi has a wheel loading of ', Semi.Wheel_Loading:8:1,
  26.            ' pounds per tire,');
  27.    WriteLn(' and has an efficiency of ', Semi.Efficiency:5:1,
  28.            ' percent.');
  29.  
  30.    with Semi do
  31.    begin
  32.       WriteLn('The semi has a wheel loading of ', Wheel_Loading:8:1,
  33.               ' pounds per tire,');
  34.       WriteLn(' and has an efficiency of ', Efficiency:5:1,
  35.               ' percent.');
  36.    end;
  37. end.
  38.  
  39.  
  40.  
  41.  
  42. { Result of execution
  43.  
  44. The unicycle weighs  12.0 pounds, and has 1 wheel.
  45. The car weighs  2100.0 pounds, and carries 5 passengers.
  46. The semi has a wheel loading of   1666.7 pounds per tire,
  47.  and has an efficiency of 83.3 percent.
  48. The semi has a wheel loading of   1666.7 pounds per tire,
  49.  and has an efficiency of 83.3 percent.
  50.  
  51. }