Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project1;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- System.SysUtils;
- Type Bus = class (TObject)
- private
- name , carbrand :string;
- number , route ,year , AutoMileage : Integer;
- public
- Constructor Create();
- destructor Destroy();
- Procedure SetDriver(s : string);
- procedure setNumber(s :integer);
- procedure setRoute(s :integer);
- procedure setCarBrand(s :string);
- procedure setYear(s :integer);
- procedure setAutoMileage(s :integer);
- end;
- Constructor Bus.Create;
- begin
- end;
- Procedure Bus.setDriver ( s:string ) ;
- begin
- name :=s;
- end;
- Procedure Bus.setNumber ( s:integer ) ;
- begin
- number :=s;
- end;
- Procedure Bus.setroute ( s:integer ) ;
- begin
- route :=s;
- end;
- Procedure Bus.setcarBrand ( s:string ) ;
- begin
- carbrand :=s;
- end;
- Procedure Bus.setyear ( s:integer ) ;
- begin
- year :=s;
- end;
- destructor Bus.Destroy;
- begin
- end;
- Procedure Bus.setAutoMileage ( s:integer ) ;
- begin
- automileage :=s;
- end;
- Var
- bus1 : array [0..10] of Bus;
- marN , busNumb , years , race :integer;
- i ,routenumber: Integer;
- begin
- routenumber:= 1002;
- for i:= 0 to 10 do
- begin
- bus1[i]:=bus.create() ;
- marN:=i + 1000;
- bus1[i].setRoute(marN);
- busNumb:=i + 10000;
- bus1[i].setNumber(busNumb);
- years:=i + 6;
- bus1[i].setYear(years);
- race:=i + 9995;
- bus1[i].setAutoMileage(race);
- end;
- writeln('number of route ');
- for i:= 0 to 10 do
- begin
- if(routenumber = bus1[i].route) then
- begin
- writeln(bus1[i].number);
- end;
- end;
- writeln('years > 10');
- for i:= 0 to 10 do
- begin
- if(bus1[i].year > 10) then
- begin
- writeln(bus1[i].number);
- end;
- end;
- writeln('mileage > 10000');
- for i:= 0 to 10 do
- begin
- if(bus1[i].AutoMileage >10000) then
- begin
- writeln(bus1[i].number);
- end;
- end;
- for i := 0 to 10 do
- begin
- bus1[i].Destroy;
- end;
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement