Você está na página 1de 59

Daftar Menu

Kalkulator Aritmatika Deret Audio Players Log In Data Mahasiswa Kubus Menu Permasalahan Matematika Volume & Luas Permukaan Persamaan Kuadrat Balok Geometri

Exit Cover

Bola

Faktorial

Konversi Suhu

1. Form Cover

Var FormCover: TFormCover; a:integer; implementation uses U_Password; {$R *.dfm} procedure TFormCover.Timer1Timer(Sender: TObject); begin Label10.Caption:='Pukul '+Timetostr(Now); Label11.Caption:='Tanggal '+Datetostr(Now); if ProgressBarCover.Position = 100 then begin Timer1.Enabled:=False; FormCover.Hide; formPassword.show; end else begin ProgressBarCover.Position :=ProgressBarCover.Position + 5; end; end; procedure TFormCover.Timer2Timer(Sender: TObject); begin a:=a+1;

if a=1 then label1.visible:=true; if a=2 then label2.Visible:=true; if a=3 then label3.Visible:=true; if a=4 then label4.Visible:=true; if a=5 then label5.Visible:=true; if a=6 then label6.Visible:=true; if a=7 then imageStkip.Visible:=true; if a=8 then label7.Visible:=true; if a=9 then label8.Visible:=true; if a=10 then label9.Visible:=true; if a=11 then begin label1.visible:=false; label2.visible:=false; label3.visible:=false; label4.visible:=false; label5.visible:=false; label6.visible:=false; imageStkip.visible:=false; label7.visible:=false; label8.visible:=false; label9.visible:=false; a:=0; end; end;

2.FORM PASSWORD

label1.visible:=true; label1.visible:=true; if a=2 then label2.Visible:=true; if a=3 then label3.Visible:=tru label3.Visible:=tru if a=4 then label4.Visible:=true; if a=5 then label5.Visible:=true; label5.Visible:=true; if a=6 then label6.Visible:=true; if a=8 then label7.Visible:=true; label7.Visible:=true; if a=9 then label8.Visible:=true; if a=10 then label9.Visible:=true; label9.Visible:=true; procedure if a=11 then TFormMenu.Timer1Timer label10.Visible:=true; (Sender: TObject); if a=12 then begin label11.Visible:=true; label11.Visible:=true; a:=a+1; if a=13 then if a=1 then label12.Visible:=true; 3. FORM MENU

if a=14 then label13.Visible:=true; label13.Visible:=true; if a=15 then label14.Visible:=true; if a=16 then label15.Visible:=true; label15.Visible:=true; if a=17 then label16.Visible:=true; if a=18 then label17.Visible:=true; label17.Visible:=true; if a=19 then image1.Visible:=true; if a=20 then image2.Visible:=true; image2.Visible:=true; if a=21 then image3.Visible:=true; if a=22 then image4.Visible:=true; image4.Visible:=true; if a=23 then image5.Visible:=true; if a=24 then

begin label1.visible:=false; label2.visible:=false; label3.visible:=false; label4.visible:=false; label5.visible:=false; label6.visible:=false; label7.visible:=false; label8.visible:=false; label9.visible:=false; label10.visible:=false; label11.visible:=false; label12.visible:=false; label13.visible:=false;

label14.visible:=false; label15.visible:=false; label16.visible:=false; label17.visible:=false; image1.Visible:=false; image2.Visible:=false; image3.Visible:=false; image4.Visible:=false; image5.Visible:=false; a:=0; end;

4.FORM AUDIO PLAYERS


procedure TFormAudioPlayers.Button1Click(Sender: TObject); begin OpenDialog1.Execute; VideoPlayer.FileName:=OpenDialog1.FileName; VideoPlayer.Open; Timer2.Enabled:=true; end; procedure TFormAudioPlayers.FileListBox1Click(Sender: TObject); begin AudioPlayer.FileName:=FileListBox1.FileName; AudioPlayer.Open; Label3.Caption:=FileListBox1.FileName; AudioBar.Max:=AudioPlayer.Length; end;

procedure TFormAudioPlayers.FileListBox1DblClick(Sen der: TObject); begin AudioPlayer.FileName:=FileListbox1.FileName; AudioPlayer.Open; Label3.Caption:=FileListBox1.FileName; AudioBar.Max:=AudioPlayer.Length; AudioPlayer.Play; AudioPlayer.Next; AudioPlayer.Previous; end; procedure TFormAudioPlayers.SpeedButton1Click(Send er: TObject); begin Paudio.Visible:=SpeedButton1.Down; end; procedure TFormAudioPlayers.SpeedButton2Click(Send er: TObject); begin vaudio.Visible:=SpeedButton1.Down; end;

procedure image1.Left:=label3.Left TFormAudioPlayers.Ti -1; mer1Timer(Sender: end; TObject); procedure begin TFormAudioPlayers.Ti if label3.left<mer3Timer(Sender: label3.Width TObject); thenlabel3.Left:=Panel2. begin Width else Videobar.Max:=VideoPl label3.Left:=label3.Left- ayer.Length; 1; Videobar.Position:=Vide AudioBar.Position:=Aud oPlayer.Position; ioPlayer.Position; end; if label5.left<procedure label5.Width TFormAudioPlayers.Ti thenlabel5.Left:=Panel3. mer2Timer(Sender: Width TObject); else begin label5.Left:=label5.Leftif image1.left<1; image1.Width thenimage1.Left:=vaudio VideoBar.Position:=Vide oPlayer.Position; .Width end; else

5.FORM DATA MAHASISWA

Var FormDataMahasiswa: TFormDataMahasiswa; s:string; p,i:integer; No,Nama,Nim,JenisKelamin,Jurusan,NoTelp,Alamat :array[1..100]of string; implementation uses U_Menu; {$R *.dfm} procedure TFormDataMahasiswa.BitBtn1Click(Sender: TObject); begin listbox1.Items.Clear; s:=inputbox('Loop','Jumlah Perulangan Data',''); p:=strtoint(s); stringgrid1.Cells[0,0]:='No'; stringgrid1.Cells[1,0]:='Nama'; stringgrid1.Cells[2,0]:='Nim'; stringgrid1.Cells[3,0]:='Jenis Kelamin'; stringgrid1.Cells[4,0]:='Jurusan'; stringgrid1.Cells[5,0]:='No Telephone'; stringgrid1.Cells[6,0]:='Alamat'; for i := 1 to p do begin

No[i]:=inputbox('ID','No',''); '+NoTelp[i]); Nama[i]:=inputbox('ID','Nama',''); listbox1.Items.Add('Alamat'+chr(1)+chr(1)+ Nim[i]:=inputbox('ID','Nim',''); chr(1)+chr(1)+' : '+Alamat[i]) JenisKelamin[i]:=inputbox('ID','Jenis listbox1.Items.Add('================ Kelamin',''); ============================== Jurusan[i]:=inputbox('ID','Jurusan',''); ============================== NoTelp[i]:=inputbox('ID','No Telp',''); ='); Alamat[i]:=inputbox('ID','Alamat',''); stringgrid1.Cells[0,i]:=No[i]; listbox1.Items.Add('No'+chr(1)+chr(1)+chr( stringgrid1.Cells[1,i]:=Nama[i]; 1)+chr(1)+chr(1)+' : '+inttostr(i)); stringgrid1.Cells[2,i]:=Nim[i]; listbox1.Items.Add('Nama'+chr(1)+chr(1)+c stringgrid1.Cells[3,i]:=JenisKelamin[i]; hr(1)+chr(1)+' : '+nama[i]); stringgrid1.Cells[4,i]:=Jurusan[i]; listbox1.Items.Add('Nim'+chr(1)+chr(1)+ch stringgrid1.Cells[5,i]:=NoTelp[i]; r(1)+chr(1)+chr(1)+' : '+Nim[i]); stringgrid1.Cells[6,i]:=Alamat[i]; listbox1.Items.Add('Jenis Kelamin'+chr(1)+' end; : '+JenisKelamin[i]); listbox1.Items.Add('Jurusan'+chr(1)+chr(1)+ chr(1)+' : '+Jurusan[i]); listbox1.Items.Add('No Telp'+chr(1)+chr(1)+chr(1)+' :

procedure stringgrid1.Cells[2,1]:=''; TFormDataMahasiswa.BitBtn stringgrid1.Cells[2,2]:=''; 2Click(Sender: TObject); stringgrid1.Cells[2,3]:=''; begin stringgrid1.Cells[2,4]:=''; listbox1.Clear; stringgrid1.Cells[2,5]:=''; stringgrid1.Cells[0,0]:=''; stringgrid1.Cells[2,6]:=''; stringgrid1.Cells[0,1]:=''; stringgrid1.Cells[2,7]:=''; stringgrid1.Cells[0,2]:=''; stringgrid1.Cells[3,0]:=''; stringgrid1.Cells[0,3]:=''; stringgrid1.Cells[3,1]:=''; stringgrid1.Cells[0,4]:=''; stringgrid1.Cells[3,2]:=''; stringgrid1.Cells[0,5]:=''; stringgrid1.Cells[3,3]:=''; stringgrid1.Cells[0,6]:=''; stringgrid1.Cells[3,4]:=''; stringgrid1.Cells[0,7]:=''; stringgrid1.Cells[3,5]:=''; stringgrid1.Cells[1,0]:=''; stringgrid1.Cells[3,6]:=''; stringgrid1.Cells[1,1]:=''; stringgrid1.Cells[3,7]:=''; stringgrid1.Cells[1,2]:=''; stringgrid1.Cells[4,0]:=''; stringgrid1.Cells[1,3]:=''; stringgrid1.Cells[4,1]:=''; stringgrid1.Cells[1,4]:=''; stringgrid1.Cells[4,2]:=''; stringgrid1.Cells[1,5]:=''; stringgrid1.Cells[4,3]:=''; stringgrid1.Cells[1,6]:=''; stringgrid1.Cells[4,4]:=''; stringgrid1.Cells[1,7]:=''; stringgrid1.Cells[4,5]:=''; stringgrid1.Cells[2,0]:=''; stringgrid1.Cells[4,6]:='';

stringgrid1.Cells[4,7]:=''; stringgrid1.Cells[5,0]:=''; stringgrid1.Cells[5,1]:=''; stringgrid1.Cells[5,2]:=''; stringgrid1.Cells[5,3]:=''; stringgrid1.Cells[5,4]:=''; stringgrid1.Cells[5,5]:=''; stringgrid1.Cells[5,6]:=''; stringgrid1.Cells[5,7]:=''; stringgrid1.Cells[6,0]:=''; stringgrid1.Cells[6,1]:=''; stringgrid1.Cells[6,2]:=''; stringgrid1.Cells[6,3]:=''; stringgrid1.Cells[6,4]:=''; stringgrid1.Cells[6,5]:=''; stringgrid1.Cells[6,6]:=''; stringgrid1.Cells[6,7]:=''; end;

6. FORM KALKULATOR

var end; FormKalkulator: TFormKalkulator; procedure MemAngka,MemLogic,MemOperator,MemSi TFormKalkulator.Button0Click(Sender mpan:string; : TObject); implementation Begin uses math; if memo1.text<>'' then {$R *.dfm} if MemLogic='0' then procedure begin TFormKalkulator.Butto5Click(Sender: if MemOperator<>'' then TObject); memo1.Text:='0' else begin if memo1.text='0' then if memo1.text<>'' then memo1.text:='0' else if MemLogic='0' then begin begin memo1.Text:=memo1.Text+'0'; MemLogic:='1'; MemLogic:='1'; if MemOperator<>'' then end; memo1.Text:='5' else end memo1.text:='5'; else end memo1.Text:=memo1.Text+'0'; else end; memo1.Text:=memo1.Text+'5';

procedure TFormKalkulator.Button1Click(Sender: TObject); begin if memo1.text<>'' then if MemLogic='0' then begin MemLogic:='1'; if MemOperator<>'' then memo1.Text:='1' else memo1.text:='1'; end else memo1.Text:=memo1.Text+'1'; end; procedure TFormKalkulator.Button2Click(Sender: TObject); begin if memo1.text<>'' then if MemLogic='0' then begin

MemLogic:='1'; if MemOperator<>'' then memo1.Text:='2' else memo1.text:='2'; end else memo1.Text:=memo1.Text+'2'; end; procedure TFormKalkulator.Button3Click(Sender: TObject); begin if memo1.text<>'' then if MemLogic='0' then begin MemLogic:='1'; if MemOperator<>'' then memo1.Text:='3' else memo1.text:='3'; end else memo1.Text:=memo1.Text+'3'; end;

procedure TFormKalkulator.Button4Click(Sender: TObject); begin if memo1.text<>'' then if MemLogic='0' then begin MemLogic:='1'; if MemOperator<>'' then memo1.Text:='4' else memo1.text:='4'; end else memo1.Text:=memo1.Text+'4'; end; procedure TFormKalkulator.Button6Click(Sender: TObject); begin if memo1.text<>'' then if MemLogic='0' then begin MemLogic:='1'; if MemOperator<>'' then memo1.Text:='6' else memo1.text:='6' ; end else memo1.Text:=memo1.Text+'6'; end;

procedure TFormKalkulator.Button7Click(Sender: TObject); begin if memo1.text<>'' then if MemLogic='0' then begin MemLogic:='1'; if MemOperator<>'' then memo1.Text:='7' else memo1.text:='7' ; end else memo1.Text:=memo1.Text+'7'; end; procedure TFormKalkulator.Button8Click(Sender: TObject); begin if memo1.text<>'' then if MemLogic='0' then begin MemLogic:='1'; if MemOperator<>'' then memo1.Text:='8' else memo1.text:='8'; end else memo1.Text:=memo1.Text+'8'; end;

procedure TFormKalkulator.Button9Click(Sender: TObject); begin if memo1.text<>'' then if MemLogic='0' then begin MemLogic:='1'; if MemOperator<>'' then memo1.Text:='9' else memo1.text:='9'; end else memo1.Text:=memo1.Text+'9'; end; procedure TFormKalkulator.ButtonAkarClick(Sender: TObject); begin if memo1.text<>'' then memo1.Text:=floattostr(sqrt(strtofloat(memo1.Text))); end;

procedure Angka)*strtofloat(memo1.Text)); TFormKalkulator.ButtonBagiClick(S if MemOperator='/' then ender: TObject); memo1.Text:=floattostr(strtofloat(Mem begin Angka)/strtofloat(memo1.Text)); if (memo1.text<>'') then if MemOperator='mod' then if MemLogic='0' then MemOperator:='/' memo1.Text:=inttostr(strtoint(MemAng else ka) mod strtoint(memo1.Text)); if (MemOperator='') then if MemOperator='div' then begin memo1.Text:=inttostr(strtoint(MemAng MemOperator:='/'; ka)div strtoint(memo1.Text)); MemLogic:='0'; if MemOperator='^' then MemAngka:=memo1.Text; memo1.Text:=floattostr(exp(strtofloat( End else begin memo1.Text)*ln(strtofloat(MemAngka) if MemOperator='+' then ))); memo1.Text:=floattostr(strtofloat(Mem MemAngka:=memo1.Text; Angka)+strtofloat(memo1.Text)); MemOperator:='/'; if MemOperator='-' then MemLogic:='0'; memo1.Text:=floattostr(strtofloat(Mem end; Angka)-strtofloat(memo1.Text)); end; if MemOperator='x' then memo1.Text:=floattostr(strtofloat(Mem

procedure if MemOperator='x' then TFormKalkulator.ButtonDivClick memo1.Text:=floattostr(strtofloat(Mem (Sender: TObject); TObject); Angka)*strtofloat(memo1.Text)); begin if MemOperator='/' then if (memo1.text<>'') then memo1.Text:=floattostr(strtofloat(Mem if MemLogic='0' then Angka)/strtofloat(memo1.Text)); MemOperator:='div' else if MemOperator='mod' then if (MemOperator='') then memo1.Text:=inttostr(strtoint(MemAn begin gka) mod strtoint(memo1.Text)); MemOperator:='div'; MemLogic:='0'; if MemOperator='div' then MemOperator:='div'; MemLogic:='0'; MemAngka:=memo1.Text; memo1.Text:=inttostr(strtoint(MemAn end gka)div strtoint(memo1.Text)); else if MemOperator='^' then begin memo1.Text:=floattostr(exp(strtofloat( if MemOperator='+' then memo1.Text)*ln(strtofloat(MemAngka memo1.Text:=floattostr(strtofloat(Mem)))); Angka)+strtofloat(memo1.Text)); MemAngka:=memo1.Text; if MemOperator='-' then MemOperator='MemOperator:='div'; MemLogic:='0'; MemOperator:='div'; MemLogic:='0'; memo1.Text:=floattostr(strtofloat(Memend; Angka)-strtofloat(memo1.Text)); Angka)-strtofloat(memo1.Text)); end;

procedure if (MemOperator='') then oat(MemAngka)/strtofloat(me TFormKalkulator.ButtonFa begin mo1.Text)); kClick(Sender: TObject); MemOperator:='x'; if MemOperator='mod' then var i,n,fak:integer; MemLogic:='0'; memo1.Text:=inttostr(strtoint( begin MemAngka:=memo1.Text; MemAngka) mod if memo1.Text<>'' then end strtoint(memo1.Text)); begin else if MemOperator='div' then n :=strtoint(memo1.Text); begin memo1.Text:=inttostr(strtoint( fak:=1; if MemOperator='+' then for i:=1 to n-1 do memo1.Text:=floattostr(strtofl MemAngka)div fak:=fak*n; oat(MemAngka)+strtofloat(me strtoint(memo1.Text)); memo1.Text:=inttostr(fak); mo1.Text)); if MemOperator='^' then MemLogic :='0'; if MemOperator='-' then end; memo1.Text:=floattostr(strtofl memo1.Text:=floattostr(exp(st rtofloat(memo1.Text)*ln(strtof end; oat(MemAngka)loat(MemAngka)))); procedure strtofloat(memo1.Text)); MemAngka:=memo1.Text; TFormKalkulator.ButtonKalif MemOperator='x' then iClick(Sender: TObject); memo1.Text:=floattostr(strtofl MemOperator:='x'; begin oat(MemAngka)*strtofloat(me MemLogic:='0'; if (memo1.text<>'') then end; mo1.Text)); if MemLogic='0' then end; if MemOperator='/' then MemOperator:='x' else memo1.Text:=floattostr(strtofl

procedure TFormKalkulator.ButtonKuadratClick(Sender: TObject); begin if memo1.text<>'' then memo1.Text:=floattostr(sqr(strtofloat(memo1.Text))); end; procedure TFormKalkulator.ButtonLnClick(Sender: TObject); begin if (memo1.text<>'') then memo1.Text := floattostr(ln(strtofloat(memo1.Text))); end; procedure TFormKalkulator.ButtonLogClick(Sender: TObject); begin if memo1.Text<=inttostr(0) then memo1.Text :='Error' else if (memo1.text<>'') then memo1.Text := floattostr(log10(strtofloat(memo1.Text))); end; procedure TFormKalkulator.ButtonMClick(Sender: TObject); begin memo1.Text := MemSimpan ; end;

procedure if MemOperator='x' then TFormKalkulator.ButtonMinClick memo1.Text:=floattostr(strtofloat(MemA (Sender: TObject); ngka)*strtofloat(memo1.Text)); begin if MemOperator='/' then if (memo1.text<>'') then memo1.Text:=floattostr(strtofloat(MemA if MemLogic='0' then MemOperator:='-' ngka)/strtofloat(memo1.Text)); else if MemOperator='mod' then if (MemOperator='') then memo1.Text:=inttostr(strtoint(MemAngk begin a) mod strtoint(memo1.Text)); MemOperator:='-'; if MemOperator='div' then MemLogic:='0'; memo1.Text:=inttostr(strtoint(MemAngk MemAngka:=memo1.Text; a)div strtoint(memo1.Text)); end if MemOperator='^' then else memo1.Text:=floattostr(exp(strtofloat(m begin emo1.Text)*ln(strtofloat(MemAngka)))); if MemOperator='+' then MemAngka:=memo1.Text; memo1.Text:=floattostr(strtofloat(MemA MemOperator:='-'; ngka)+strtofloat(memo1.Text)); MemLogic:='0'; if MemOperator='-' then end; end; memo1.Text:=floattostr(strtofloat(MemA ngka)-strtofloat(memo1.Text));

procedure TFormKalkulator.ButtonMrClick(Sender: TObject); begin MemSimpan := memo1.Text ; MemLogic := '0'; MemOperator :=''; MemAngka := '0'; end; procedure TFormKalkulator.ButtonNotClick(Sender: TObject); begin if memo1.text<>'' then memo1.Text:=floattostr(strtofloat(memo1.Text)*(-1)); {mengubah nilai memo1 menjadi positif atau negatif} end; procedure TFormKalkulator.ButtonoffClick(Sender: TObject); begin memo1.clear; {mengosongkan tampilan layar calculator} MemLogic:=''; MemSimpan :='0'; {menonaktifkan ketiga radiobutton} RbDEG.Checked :=false; RbRAD.Checked :=false; RbGRADS.Checked:=false; end;

procedure TFormKalkulator.ButtonOnClick(Sender: TObject); begin {setting ketika tombol on ditekan} Memo1.Text:='0'; {membuat layar kalkulator berisi angka 0} MemLogic:='0'; {merubah nilai variable MemLogic menjadi 0} MemOperator :=''; {mengosongkan nilai variable MemOperator} MemAngka :='0'; {merubah nilai variable MemAngka menjadi 0} {mengaktifkan kembali ketiga radiobutton} RbDEG.Enabled:=true; RbRAD.Enabled:=true; RbGRADS.Enabled:=true; RbDEG.Checked:=true; {mengecek radiobutton RbDeg} end;

procedure memo1.Text:=floattostr(strtofloat(MemAngka) TFormKalkulator.ButtonPangkatClick(Sen*strtofloat(memo1.Text)); der: TObject); if MemOperator='/' then begin memo1.Text:=floattostr(strtofloat(MemAngka) if (memo1.text<>'') then if /strtofloat(memo1.Text)); MemLogic='0' then MemOperator:='^' else if MemOperator='mod' then if (MemOperator='') then memo1.Text:=inttostr(strtoint(MemAngka) begin mod strtoint(memo1.Text)); if MemOperator='div' then MemOperator:='^'; memo1.Text:=inttostr(strtoint(MemAngka)div MemLogic:='0'; strtoint(memo1.Text)); MemAngka:=memo1.Text; if MemOperator='^' then end memo1.Text:=floattostr(exp(strtofloat(memo1. else Text)*ln(strtofloat(MemAngka)))); begin MemAngka:=memo1.Text; if MemOperator='+' then memo1.Text:= floattostr(strtofloat(MemAngka)+strtofloat(me MemOperator:='^'; MemLogic:='0'; mo1.Text)); end; if MemOperator='-' then memo1.Text:= end; floattostr(strtofloat(MemAngka)strtofloat(memo1.Text)); if MemOperator='x' then

procedure TFormKalkulator.ButtonPerClick(Sender: TObject); begin if memo1.Text = '0' then memo1.Text:='Error divide zero' else if memo1.Text<>'' then memo1.Text :=floattostr(1/strtofloat(memo1.Text)); MemLogic :='0'; end; procedure TFormKalkulator.ButtonPhiClick(Sender: TObject); begin if memo1.Text<>'' then memo1.Text := floattostr(pi); end;

procedure TFormKalkulator.ButtonPointClick(Sender: TObject); begin if memo1.text<>'' then memo1.Text:=memo1.Text + '.'; {menambahkan tanda desimal(titik) pada teks dari memo} end; procedure TFormKalkulator.ButtonSinClick(Sender: TObject); var sudut:real; begin if memo1.Text<>'' then begin sudut:=strtofloat(memo1.Text); if RbDeg.Checked = true then sudut:=sudut*pi/180 else if RbRad.Checked = true then sudut:=sudut else if RbGrads.Checked = true then sudut:=sudut*pi/200; memo1.Text := floattostr(sin(sudut)); MemLogic :='0'; end; end;

procedure TFormKalkulator.ButtonResultClick(Sender: TObject); begin if MemOperator='+' then memo1.Text:=floattostr(strtofloat(MemAngka)+strtofloat(memo1.Text)); if MemOperator='-' then memo1.Text:=floattostr(strtofloat(MemAngka)strtofloat(memo1.Text)); if MemOperator='x' then memo1.Text:=floattostr(strtofloat(MemAngka)*strtofloat(memo1.Text)); if MemOperator='/' then memo1.Text:=floattostr(strtofloat(MemAngka)/strtofloat(memo1.Text)); if MemOperator='mod' then memo1.Text:=inttostr(strtoint(MemAngka) mod strtoint(memo1.Text)); if MemOperator='div' then memo1.Text:=inttostr(strtoint(MemAngka)div strtoint(memo1.Text)); if MemOperator='^' then memo1.Text:=floattostr(exp(strtofloat(memo1.Text)*ln(strtofloat(MemAngka)))); MemAngka:=memo1.Text; MemLogic:='0'; end;

procedure TFormKalkulator.ButtonTanClick(Sender: TObject); var sudut:real; begin if memo1.Text<>'' then begin sudut:=strtofloat(memo1.Text); if RbDeg.Checked = true then sudut:=sudut*pi/180 else if RbRad.Checked = true then sudut:=sudut else if RbGrads.Checked = true then sudut:=sudut*pi/200; memo1.Text := floattostr(tan(sudut)); MemLogic :='0'; end; end; procedure TFormKalkulator.FormCreate(Sender: TObject); begin memo1.Clear;{mengosongkan caption / lines dari memo1} {menonaktifkan ketiga radiobutton} RbDEG.Enabled:=false; RbRAD.Enabled:=false; RbGRADS.Enabled:=false; end;

7. A. DERET ARITMATIKA

var FormDrtAritmatika: TFormDrtAritmatika; i,n:integer; a,b,m,Un,Sn:real; implementation uses U_Menu; {$R *.dfm} procedure TFormDrtAritmatika.BitBtn1Click (Sender: TObject); begin close; end; procedure TFormDrtAritmatika.Button1Click (Sender: TObject); begin a:=strtofloat(edit1.Text); b:=strtofloat(edit2.Text); n:=strtoint(edit3.Text); Un:=a+(n-1)*b; Sn:=1/2*n*(a+Un);

m:= -1; Listbox1.Items.Add(' Tampilan Hasil Jumlah Deret Aritmetika '); for i:=1 to n do begin m:=m+b; listbox1.Items.add(' Nilai Suku Ke '+inttostr(i)+' atauU '+inttostr(i)+' = '+floattostr(m)); end; Listbox1.Items.Add(' Nilai Suku Pertama atau a= '+floattostr(a)); Listbox1.Items.Add(' Nilai Beda Bilangan atau b= '+floattostr(b)); listbox1.Items.add(' Jumlah Deret Aritmetika '+inttostr(n)+' Suku Pertama= ' +floattostr(Sn)); listbox1.Visible:=true; end;

7. B. DERET GEOMETRI

procedure TFormDrtGeometri.BitBtn2Click(Sender: TObject); begin edit1.Clear; edit2.Clear; edit3.Clear; listbox1.Clear; listbox1.Visible:=false; end; procedure TFormDrtGeometri.BitBtn3Click(Sender: TObject); begin close; end

8. A. VOLUME DAN LUAS PERMUKAAN KUBUS

var FormVLpKubus: TFormVLpKubus; s:string; a,p,i:integer; a,p,i:integer; Sisi :array[1..30]of string; V,L:real; V,L:real; implementation uses U_Menu; {$R *.dfm} procedure TFormVLpKubus.Button1Click(Sender: TObject); begin edit1.Clear; listbox1.Items.Clear; s:=inputbox('Loop','Jumlah Perulangan',''); p:=strtoint(s); for i := 1 to p do begin Sisi[i]:=inputbox('ID','Sisi',''); edit1.Text:=Sisi[i]; end; end; end; procedure TFormVLpKubus.Button2Click(Sender: TObject); begin

listbox1.Clear; listbox1.Clear; image2.Visible:=false; image2.Visible:=false; edit1.Clear; listbox1.Visible:=false; listbox1.Visible:=false; end; end; procedure TFormVLpKubus.Button3Click(Sender: TObject); begin close; end; procedure TFormVLpKubus.Button4Click(Sender: TObject); begin a:=strtoint(edit1.Text); a:=strtoint(edit1.Text); V:=a*a*a; listbox1.Items.Add('Jadi volume kubus adalah ='+inttostr(a)+' x '+inttostr(a)+' x '+inttostr(a)+' = '+floattostr(V)); L:=6*a*a; Listbox1.Items.Add('Jadi luas permukaan kubus adalah = 6 ('+inttostr(a)+' X '+inttostr(a)+' ) '+' = '+floattostr(L)); image2.Visible:=true; listbox1.Visible:=true; listbox1.Visible:=true; end;

procedure TFormVLpBalok.BitBtn1Click(Sender: TObject); var panjang,lebar,tinggi:integer; V,L:real; begin panjang:=strtoint(edit1.Text); lebar:=strtoint(edit2.Text); tinggi:=strtoint(edit3.Text); V:=panjang*lebar*tinggi; listbox1.Items.Add('Jadi Volumenya Adalah '+' = '+inttostr(panjang)+' X '+inttostr(lebar)+' X '+inttostr(tinggi)+' = '+floattostr(V)); L:= 2*(panjang*lebar+panjang*tinggi+lebar*tinggi); listbox1.Items.Add('Jadi Luas Permukaanya Adalah = ' + '2 ('+inttostr(panjang) +'x'+inttostr(lebar)+'+'+ inttostr(panjang)+'x'+inttostr(tinggi)+'+'+inttostr(lebar) +'x'+inttostr(tinggi)+') ='+floattostr(L)); image1.visible:=true; end;

procedure TFormVLpBalok.BitBtn2Click(Sender: TObject); begin edit1.Clear; edit2.Clear; edit3.Clear; listbox1.Clear; image1.Visible:=false; end; procedure TFormVLpBalok.BitBtn3Click(Sender: TObject); begin close; end; procedure TFormVLpBalok.Timer1Timer(Sender: TObject); begin if label1.Visible=true then label1.Visible:=false else label1.Visible:=true; end;

8. C. VOLUME DAN LUAS PERMUKAAN BOLA

procedure edit2.Clear; TFormVLpBola.Button1Click edit3.Clear; (Sender: TObject); image1.Visible:=false; var image2.Visible:=true; r:integer; end; Volume,Luas:real; procedure begin TFormVLpBola.Button3Click(Sende r:=strtoint(edit1.Text); r: TObject); Volume:=3/4*3.14*r*r*r; begin edit2.Text:=floattostr(Volume); close; Luas:=4*3.14*r*r; end; edit3.Text:=floattostr(Luas); image1.Visible:=true; image2.Visible:=false; end; procedure TFormVLpBola.Button2Click(Sende r: TObject); begin edit1.Clear;

9. PERSAMAAN KUADRAT

VAR EDIT7.TEXT:=FLOATTOSTR(G); FORMPERSKUADRAT: END TFORMPERSKUADRAT; ELSE IF D>0 THEN A,B,C,D,E,F,G:REAL; BEGIN IMPLEMENTATION E:=(-B + SQRT(D))/(2*A); USES U_MENU; F:=(-B - SQRT(D))/(2*A); {$R *.DFM} EDIT5.TEXT:=FLOATTOSTR(E); PROCEDURE EDIT6.TEXT:=FLOATTOSTR(F); TFORMPERSKUADRAT.BITBTN1CLI LABEL14.VISIBLE:=TRUE; CK G:=(E*E)+(F*F); (SENDER: TOBJECT); EDIT7.TEXT:=FLOATTOSTR(G); BEGIN END A:=STRTOFLOAT(EDIT1.TEXT); ELSE IF D<0 THEN B:=STRTOFLOAT(EDIT2.TEXT); BEGIN C:=STRTOFLOAT(EDIT3.TEXT); E:=-B/(2*A); D:=B*B-4*A*C; F:=SQRT(-D)/(2*A); EDIT4.TEXT:=FLOATTOSTR(D); EDIT5.TEXT:=FLOATTOSTR(E); IF D=0 THEN EDIT6.TEXT:=FLOATTOSTR(F); BEGIN LABEL15.VISIBLE:=TRUE; E:=-B/(2*A); F:=-B/(2*A); G:=(E*E)+(F*F); EDIT5.TEXT:=FLOATTOSTR(E); EDIT7.TEXT:=FLOATTOSTR(G); EDIT6.TEXT:=FLOATTOSTR(F); END; LABEL10.VISIBLE:=TRUE; END; G:=(E*E)+(F*F);

procedure TFormPersKuadrat.BitBtn3Click (Sender: TObject); begin close; end; procedure TFormPersKuadrat.Button1Click(S ender: TObject); begin edit1.Clear; edit2.Clear; edit2.Clear; edit3.Clear; edit3.Clear; edit4.Clear; edit5.Clear; edit5.Clear; edit6.Clear; edit6.Clear; edit7.Clear; label10.visible:=false; label10.visible:=false; label14.visible:=false; label15.visible:=false;

end; end; procedure TFormPersKuadrat.Timer1Timer(S ender: TObject); begin if label10.left<-label10.Width then label10.left<label10.Left:=Width else label10.Left:=label1.Leftlabel10.Left:=label1.Left-1; if label15.left<-label15.Width then label15.left<label15.Left:=Width else label15.Left:=label15.Leftlabel15.Left:=label15.Left-1; if label14.left<-label14.Width then label14.left<label14.Left:=Width else label14.Left:=label14.Leftlabel14.Left:=label14.Left-1; end;

10. FAKTORIAL

var FormFaktorial: TFormFaktorial; a,i,j,jumlah,fakt1,fakt2:integer; bilangan:array[1..20]of integer; implementation uses U_Menu; {$R *.dfm} procedure TFormFaktorial.BitBtn1Click (Sender: TObject); begin bilangan[a]:=strtoint(edit2.Text); for a:= 1 to 5 do jumlah:=jumlah+bilangan[a]; listbox1.Items.Add ('Jumlah Bilangan = '+inttostr(jumlah)); '+inttostr(jumlah)); fakt2:=1; for j := 2 to jumlah do fakt2:=fakt2*j;

listbox1.Items.Add('Faktorial dari '+inttostr(jumlah)+' adalah ='+inttostr(fakt2)); end; procedure TFormFaktorial.BitBtn2Click(Sende r: TObject); begin a:=1; edit1.Text:=inttostr(a); edit2.Clear; listbox1.Clear; end; procedure TFormFaktorial.BitBtn3Click(Sende r: TObject); begin close; end;

11. KONVERSI SUHU

procedure TFormKonversiSuhu.Button1Click(Sender: TObject); begin if Edit1.Text <> '' then begin Edit2.Text := floattostr(strtofloat(Edit1.Text)*9/5+32) + ''; Edit3.Text := floattostr(strtofloat(Edit1.Text)*4/5) + ''; Edit4.Text := floattostr(strtofloat(Edit1.Text)+273)+ '' ; Edit1.Text := Edit1.Text + ''; end; end; procedure TFormKonversiSuhu.Button2Click(Sender: TObject); begin edit1.Clear; edit2.Clear; edit3.Clear; edit4.Clear; edit1.SetFocus; end;

procedure TFormKonversiSuhu.Button3Click(Sender: TObject); begin close; end; procedure TFormKonversiSuhu.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key = #13 then Button1.Click; end; procedure TFormKonversiSuhu.FormCreate(Sender: TObject); VAR busur:HRGN; oke:HBRUSH; setengah:HDC; begin busur:=createellipticrgn(5,5,500,500); setwindowrgn(handle,busur,true); deleteobject(busur); end;

12. SELESAI

var FormExit: TFormExit; a,s:integer; implementation {$R *.dfm} procedure TFormExit.BitBtn1Click(Sender: TObject); begin application.Terminate; end;

procedure TFormExit.Timer1Timer(Sender: TObject); begin a:=a+1; if a=1 then label1.visible:=true; if a=2 then label2.Visible:=true; if a=3 then label3.Visible:=true; if a=4 then label4.Visible:=true; if a=5 then begin label1.visible:=false; label2.visible:=false; label3.visible:=false; label4.visible:=false; a:=0; end; end;

KEPUASAN YANG TIDAK AKAN TERBAYARKAN KETIKA HASIL KARYA KIAT DITERIMA OLEH ORANG LAIN. KEMUDIAN DIJADIKAN PANDUAN OLEH ORANG LAIN TERSEBUT. SEMOGA APA YANG SAYA KERJAKAN BERMANFAAT BAGI BANYAK ORANG. AMIIIIIN...........

Você também pode gostar