X-88

FPC test

Apr 22nd, 2021 (edited)
190
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program Project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Classes, SysUtils, CustApp, crt
  10.   { you can add units after this };
  11.  
  12. type
  13.  
  14.   { TMyApplication }
  15.  
  16.   TMyApplication = class(TCustomApplication)
  17.   protected
  18.     procedure DoRun; override;
  19.   public
  20.   end;
  21.  
  22. { TMyApplication }
  23.  
  24. var
  25.     Total, Gaji, Tunjangan: real;
  26.     Jumlahanak: integer;
  27.     Keterangan : string[25];
  28.     Y: char;
  29.  
  30.  //Label ulang;
  31.  
  32. {
  33.  procedure ulang;
  34.  begin
  35.  Write('Masukkan Gaji: ');
  36.     read(Gaji);
  37.     Write('Masukkan jumlah anak: ');
  38.     read(Jumlahanak);
  39.     Tunjangan := 0.25 * Gaji + Jumlahanak * 30000;
  40.     Total := Gaji + Tunjangan;
  41.     Keterangan := 'Karyawan Teladan';
  42.     Writeln('Gaji bulanan= Rp.', Gaji);
  43.     Writeln('Tunjangan = Rp. ', Tunjangan);
  44.     Writeln ('Total gaji = Rp. ', Total);
  45.     Writeln('Keterangan = ', Keterangan );
  46.     Write(' Mau menghitung lagi? [Y/T]', #10#13, '>>>');
  47.     Y := readkey;
  48. if upcase(y) = 'Y' then
  49.     ulang;
  50.     Readln;
  51.  end;
  52. }
  53.  
  54. procedure TMyApplication.DoRun;
  55. var
  56.   ErrorMsg: String;
  57. Begin
  58.     //Ulang:
  59.     clrscr(); //clear screen
  60.     textcolor($0a);
  61.     Write('Masukkan Gaji: ');
  62.     read(Gaji);
  63.     Write('Masukkan jumlah anak: ');
  64.     read(Jumlahanak);
  65.     Tunjangan := 0.25 * Gaji + Jumlahanak * 30000;
  66.     Total := Gaji + Tunjangan;
  67.     Keterangan := 'Karyawan Teladan';
  68.     Writeln('Gaji bulanan= Rp.', Gaji);
  69.     Writeln('Tunjangan = Rp. ', Tunjangan);
  70.     Writeln ('Total gaji = Rp. ', Total);
  71.     Writeln('Keterangan = ', Keterangan );
  72.     Write(' Mau menghitung lagi? [Y/T]', #10#13, '>>>');
  73.     Y := readkey;
  74.     //read(y);
  75. if (UpCase(Y) = 'Y') or (LowerCase(Y) = 'y') then
  76.     // goto Ulang; //ini error
  77.     //gotoxy(1, 1); //ini error
  78.     dorun(); //panggil main prosedur
  79.     Readln;
  80.  
  81.   // ulang; //utk panggil prosedur ulang
  82.  
  83.   // stop program loop
  84.   Terminate;
  85. end;
  86.  
  87. var
  88.   Application: TMyApplication;
  89. begin
  90.   Application:=TMyApplication.Create(nil);
  91.   Application.Title:='My Application';
  92.   Application.Run;
  93.   Application.Free;
  94. end.
  95.  
RAW Paste Data