Anda di halaman 1dari 7

Tugas 2 PEMROGRAMAN VISUAL II

Oleh IMADUDDIN 2011 020 179


JURUSAN TEKNIK INFORMATIKA SEKOLAH TINGGI MANAJEMEN INFORMATIKA DAN KOMPUTER (STMIK)HANDAYANI MAKASSAR 2013

Preview Form Login

Coding Untuk Form Login: unit Login; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TFLogin = class(TForm) Label1: TLabel; Label2: TLabel; Edit1: TEdit; Edit3: TEdit; Button1: TButton; Login: TButton; Edit2: TEdit; procedure Button1Click(Sender: TObject); procedure LoginClick(Sender: TObject); private { Private declarations } public { Public declarations } simpan:string; end; var FLogin: TFLogin; nama, databaru,m,password,p: string; k, i,j: integer; implementation uses sandi, Menu; {$R *.dfm} procedure TFLogin.Button1Click(Sender: TObject); begin nama:=Edit1.text; databaru:=''; for i := 1 to length(nama) do begin k:=ord(nama[i]); m:= inttostr (k); if (length(m)=2) then m:='0'+m;

databaru:=databaru+m; end; password:=''; for i := 1 to length (databaru) do begin password:=databaru[i]+password; end; Edit3.Text:=password; Flogin.hide; FPassword.showmodal; Flogin.Show; end; procedure TFLogin.LoginClick(Sender: TObject); begin nama:=Edit1.text; databaru:=''; for i := 1 to length(nama) do begin k:=ord(nama[i]); m:= inttostr (k); if (length(m)=2) then m:='0'+m; databaru:=databaru+m; end; password:=''; for i := 1 to length (databaru) do begin password:=databaru[i]+password; end; if (Edit2.Text='') then showmessage ('Masukkan Password') else if (password=Edit2.text) then FMenu.ShowModal else showmessage('Password Salah'); end; end.

Preview Form Menu Coding Form Menu unit Menu; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TFMenu = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Panel1: TPanel; Button1: TButton; Button2: TButton; Button4: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button4Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var FMenu: TFMenu; implementation uses TParsingU, Enkripsi; {$R *.dfm} procedure TFMenu.Button1Click(Sender: TObject); begin FParsing.ShowModal; end; procedure TFMenu.Button2Click(Sender: TObject); begin FEnkripsi.ShowModal; end; procedure TFMenu.Button4Click(Sender: TObject); begin close; end; end.

Preview Form Tugas 1 & 2 : Teknik Parsing Coding Form Parsing

unit TParsingU; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TFParsing = class(TForm) Edit1: TEdit; Button1: TButton; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Panel1: TPanel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var FParsing: TFParsing; dataawal: string; jkar, pt1, pt2, pt3: integer; implementation uses Parsing1, Parsing3, Parsing2; {$R *.dfm} procedure TFParsing.Button1Click(Sender: TObject); begin pt1:=0; pt2:=0;pt3:=0; dataawal:=Edit1.Text; jkar:=length(dataawal); pt1:=pos('@', dataawal); pt2:=pos('#', dataawal); pt3:=pos('$', dataawal); if (pt1>0) and (pt2>0) and (pt3>0) then begin Edit2.Text:=copy(dataawal,pt1+1,pt2-pt1-1); Edit3.Text:=copy(dataawal,pt2+1,pt3-pt2-1); Edit4.Text:=copy(dataawal,pt3+1,jkar-pt3); end else ShowMessage('Salah Input'); if(Edit4.Text = 'E1') then FParsing3.Show; end; procedure TFParsing.Button2Click(Sender: TObject); Var PesanDiterima,VarOperasi,VarTarget:String; begin // mulailah memilah pesan (parsing)

PesanDiterima:=Edit4.Text; VarOperasi:=copy(PesanDiterima,1,1); VarTarget:=copy(PesanDiterima,3,1); // memilah proses hasil parsing if VarOperasi='x' then begin if VarTarget='1' then begin FParsing1.Caption:=VarOperasi+VarTarget; FParsing1.ShowModal; end else if VarTarget='2' then begin FParsing2.Caption:=VarOperasi+VarTarget; FParsing2.ShowModal; end else if VarTarget='3' then begin FParsing3.Caption:=VarOperasi+VarTarget; FParsing3.ShowModal; end else showmessage ('Salah Input'); end else showmessage ('Salah Input'); end; end. Preview Tugas 3 : Enkripsi

Coding Form Enkripsi unit Enkripsi; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TFEnkripsi = class(TForm)

Label1: TLabel; Label2: TLabel; Label3: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var FEnkripsi: TFEnkripsi; dataasli, databaru: string; k, i,j: integer; implementation {$R *.dfm} procedure TFEnkripsi.Button1Click(Sender: TObject); begin dataasli:=Edit1.text; databaru:=''; for i := 1 to length(dataasli) do begin k:=ord(dataasli[i])-2; databaru:=databaru+chr(k); end; Edit2.Text:=databaru; end; procedure TFEnkripsi.Button2Click(Sender: TObject); begin dataasli:=Edit2.text; databaru:=''; for i := 1 to length(dataasli) do begin k:=ord(dataasli[i])+2; databaru:=databaru+chr(k); end; Edit3.Text:=databaru; end; end.