Category : Pascal Source Code
Archive   : PASTUT.ZIP
Filename : CARTRUCK.PAS

 
Output of file : CARTRUCK.PAS contained in archive : PASTUT.ZIP
(* Chapter 15 - Program 5 *)
unit CarTruck;

interface

uses Vehicles;

type
Car = object(Vehicle)
Passenger_Load : integer;
constructor Init(In_Wheels : integer;
In_Weight : real;
People : integer);
function Passengers : integer;
end;


Truck = Object(Vehicle)
Passenger_Load : integer;
Payload : real;
constructor Init(People : integer;
Max_Load : real;
In_Wheels : integer;
In_Weight : real);
function Efficiency : real;
function Wheel_Loading :real;
end;

implementation

constructor Car.Init(In_Wheels : integer;
In_Weight : real;
People : integer);
begin
Wheels := In_Wheels;
Weight := In_Weight;
Passenger_Load := People;
end;

function Car.Passengers : integer;
begin
Passengers := Passenger_Load;
end;

constructor Truck.Init(People : integer;
Max_Load : real;
In_Wheels : integer;
In_Weight : real);
begin
Passenger_Load := People;
Payload := Max_Load;
Vehicle.Init(In_Wheels, In_Weight);
end;

function Truck.Efficiency : real;
begin
Efficiency := 100.0 * Payload / (Payload + Weight);
end;

function Truck.Wheel_Loading : real;
begin
Wheel_Loading := (Weight + Payload)/Wheels;
end;

end.




{ Result of execution

(This file cannot be executed)

}

  3 Responses to “Category : Pascal Source Code
Archive   : PASTUT.ZIP
Filename : CARTRUCK.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/