unit Un_Abonent;

interface

type TAbonent=class
              private
              FFIO:string;
              FAdress:string;
              Fnumberphone:string;
              Fbalans:string;
              public
              constructor Create (var t:TextFile);
              constructor Create_Read;
              constructor Create_numberphone;
              function compare(Aabonent:TAbonent):integer;//(Fnumberphone<>=obj)
              function comparenumber(AAbonent:TAbonent):boolean;
              function Stop(AAbonent:tAbonent):Boolean;
              procedure Print;
              property FIO:string read FFIO;
              property Adress:string read FAdress;
              property Numberphone:string read FNumberphone;
              property Balans:string read FBalans write FBalans;

              end;

implementation

  constructor TAbonent.Create;
  begin
    inherited Create; // объем памяти
    Readln(t,FFio);
    Readln(t,FAdress);
    Readln(t,Fnumberphone);
    Readln(t,Fbalans);
   if   not Eof(t)then Readln(t)//пропуск пустой строки
  end;

  constructor TAbonent.Create_Read;
  begin
    inherited Create; // объем памяти
    Readln(FFio);
    Readln(FAdress);
    Readln(Fnumberphone);
    Readln(Fbalans);
    end;

  constructor TAbonent.Create_numberphone;
  begin
    inherited Create;
    Readln(Fnumberphone)
  end;

  procedure TAbonent.Print;
  begin
    Writeln('ФИО: ',FFIO);
    Writeln('Адрес: ',FAdress);
    Writeln('Номер телефона: ',Fnumberphone);
    Writeln('Баланс: ',Fbalans);
    Writeln('---------------------------')
  end;

  function TAbonent.Compare;
  begin
    if Fnumberphone=Aabonent.Fnumberphone then result:=0
                                  else
    if Fnumberphone<Aabonent.Fnumberphone then result:=-1
                                   else result:=1;
  end;

  function TAbonent.comparenumber;
  begin
    result:=Copy(AAbonent.Fnumberphone,2,3)=Copy(Fnumberphone,2,3)
  end;

  function TAbonent.stop;
  begin
    stop:=False;
    if Copy(Fnumberphone,2,3)>copy(aabonent.Fnumberphone,2,3) then stop:=True;
  end;

end.

