                           (* Chapter 15 - Programming example 2 *)
program Inheritance_2;

uses vehicles, CarTruck;

{ ************************ main program ************************** }

var Unicycle : Vehicle;
    Sedan    : Car;
    Semi     : Truck;
    Pick_Up  : Truck;

begin

   Unicycle.Init(1, 12.0);
   Sedan.Init(4, 2100.0, 5);
   Semi.Init(1, 25000.0, 18, 5000.0);
   Pick_Up.Init(3, 3200.0, 6, 1350.0);

   WriteLn('The unicycle weighs ', Unicycle.Get_Weight:5:1,
           ' pounds, and has ', Unicycle.Get_Wheels, ' wheel.');

   WriteLn('The car weighs ', Sedan.Get_Weight:7:1,
           ' pounds, and carries ', Sedan.Passengers,
           ' passengers.');

   WriteLn('The semi has a wheel loading of ', Semi.Wheel_Loading:8:1,
           ' pounds per tire,');
   WriteLn(' and has an efficiency of ', Semi.Efficiency:5:1,
           ' percent.');

   WriteLn('The pickup has a wheel loading of ',
           Pick_Up.Wheel_Loading:8:1, ' pounds per tire,');
   WriteLn(' and has an efficiency of ', Pick_Up.Efficiency:5:1,
           ' percent.');

   with Semi do
   begin
      WriteLn('The semi has a wheel loading of ', Wheel_Loading:8:1,
              ' pounds per tire,');
      WriteLn(' and has an efficiency of ', Efficiency:5:1,
              ' percent.');
   end;
end.




{ Result of execution

The unicycle weighs  12.0 pounds, and has 1 wheel.
The car weighs  2100.0 pounds, and carries 5 passengers.
The semi has a wheel loading of   1666.7 pounds per tire,
 and has an efficiency of 83.3 percent.
The pickup has a wheel loading of    758.3 pounds per tire,
 and has an efficiency of 70.3 percent.
The semi has a wheel loading of   1666.7 pounds per tire,
 and has an efficiency of 83.3 percent.

}