SHARE
TWEET

Untitled

a guest Jan 12th, 2020 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program laba_14;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. {$R *.res}
  6.  
  7. uses
  8.   System.SysUtils;
  9.  
  10. type Worker = class
  11. Nam: String;
  12. Role: String;
  13. Salary: Real;
  14. procedure UpdateSalary;
  15. procedure UpdateRole;
  16. end;
  17.  
  18. procedure Worker.UpdateSalary;
  19. begin
  20.   Salary:= Salary + Salary * 0.15;
  21.   Writeln('Новая зарплата - ', Round(Salary));
  22. end;
  23. procedure Worker.UpdateRole();
  24. var c: Char;
  25. begin
  26.  if (Nam.StartsWith('Иван')) then
  27.  begin
  28.  Writeln(Nam, ', вам предложена должность "ИНЖЕНЕР"!');
  29.  Writeln('Принять? - Y/N');
  30.  Readln(c);
  31.  if (c = 'Y') then
  32.  begin
  33.   Role:= 'Инженер';
  34.   Writeln('Информация обновлена.');
  35.  end;
  36.  end;
  37.  
  38.  
  39. end;
  40.  
  41. var I,Z: Worker;
  42. begin
  43.    Writeln('Первый работник: ');
  44.    I:= Worker.Create;
  45.    Z:= Worker.Create;
  46.    I.Nam:= 'Иванов';
  47.    I.Role:= 'Слесарь';
  48.    I.Salary:= 300;
  49.    I.UpdateSalary;
  50.    I.UpdateRole;
  51.    Writeln;
  52.    Writeln('Второй работник: ');
  53.    Z.Nam:= 'Денисенко';
  54.    Z.Role:= 'Директор';
  55.    Z.Salary:= 2300;
  56.    Z.UpdateSalary;
  57.    Z.UpdateRole;
  58.    Readln;
  59. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top