LISTING PROGRAM MATEMATIKAProgram Delphi
Disusun untuk memenuhi tugas akhir mata kuliah Program Komputer
Dosen Pembimbing: Deddy Sofyan, M.Pd.
Oleh :Barkah Ismail Aji
09512049Kelas 2 C
Jurusan Pendidikan MatematikaSekolah Tinggi Keguruan dan Ilmu Pendidikan
(STKIP) GARUTJuli 2011
Program Matematika
1. Program animasi
procedure brAnimasiTivi(FForm:TForm; Muncul:Boolean);var i,j,k,l:Integer; hs : array [0..600] of hrgn;begin j:=0;i:=0;l:=0; //--------------------------------------------------------------------- Muncul if Muncul then begin for k:=0 to 800 do begin if (j+2<(FForm.Height div 2)) then begin j:=j+2; if j>(FForm.height div 2) then i:=FForm.width; hs[k]:=CreateRectRgn(i,j,FForm.width-i,FForm.height-j); end else if (i+6<FForm.Width div 2) then begin i:=i+8; hs[k]:=CreateRectRgn(i,j,FForm.width-i,FForm.height-j); end else begin l:=k; break; end;//if end;//for SetWindowRgn(FForm.handle,CreateRectRgn(0,0,0,0),true); FForm.visible:=true; for i:=l downto 0 do begin SetWindowRgn(FForm.handle,hs[i],true); sleep(10);
end; SetWindowRgn(FForm.handle,0,true); end else //--------------------------------------------------------------------- Hilang begin //Tidak Muncul for k:=0 to 599 do begin if (j+2<(FForm.Height div 2)) then begin j:=j+2; if j>(FForm.height div 2) then i:=FForm.width; hs[k]:=CreateRectRgn(i,j,FForm.width-i,FForm.height-j); end else if (i+6<FForm.Width div 2) then begin i:=i+8; hs[k]:=CreateRectRgn(i,j,FForm.width-i,FForm.height-j); end else begin l:=k; break; end;//if end;//for for i:=0 to l do begin SetWindowRgn(FForm.handle,hs[i],true); sleep(5); end; SetWindowRgn(FForm.handle,CreateRectRgn(0,0,0,0),true); end;//ifend;procedure Tanimasi.FormClose(Sender: TObject; var Action: TCloseAction);beginbrAnimasiTivi(Self, False);end;
procedure Tanimasi.FormCreate(Sender: TObject);beginbrAnimasiTivi(Self, True);end;
procedure Tanimasi.SpeedButton1Click(Sender: TObject);beginif edit3.Text='' thenbeginmessagedlg('kolom password belum terisi',mtinformation,[mbretry],0);endelseif edit3.Text=gen.label1.caption thenbegingen.Hide;
animasi.Hide;awal.Show;end
end;
procedure Tanimasi.SpeedButton2Click(Sender: TObject);begingen.show;end;
procedure Tanimasi.SpeedButton3Click(Sender: TObject);beginapplication.terminate;end;
procedure Tanimasi.SpeedButton4DblClick(Sender: TObject);beginTouchKeyboard1.Visible:=false;end;
procedure Tanimasi.Timer1Timer(Sender: TObject);begina:=a+1; if a mod 13 =0 then begin label1.Caption:='Welcome'; label2.Caption:=''; label3.Caption:='my'; label4.Caption:=''; end else if a mod 13=1 then begin label1.Caption:=''; label2.Caption:='to'; label3.Caption:=''; label4.Caption:='project'; end else if a mod 13=2 then begin label1.Caption:=''; label2.Caption:=''; label3.Caption:='my';
label4.Caption:=''; end else if a mod 13=3 then begin label1.Caption:='welcome'; label2.Caption:=''; label3.Caption:=''; label4.Caption:=''; end else if a mod 13=4 then begin label1.Caption:=''; label2.Caption:=''; label3.Caption:=''; label4.Caption:='project'; end else if a mod 13=5 then begin label1.Caption:=''; label2.Caption:='to'; label3.Caption:=''; label4.Caption:=''; end else if a mod 13=6 then begin label1.Caption:=''; label2.Caption:=''; label3.Caption:=''; label4.Caption:=''; end else if a mod 13=7 then begin label1.Caption:='welcome'; label2.Caption:=''; label3.Caption:=''; label4.Caption:=''; end else if a mod 13=8 then begin label1.Caption:='';
label2.Caption:='to'; label3.Caption:=''; label4.Caption:=''; end else if a mod 13=9 then begin label1.Caption:=''; label2.Caption:=''; label3.Caption:='my'; label4.Caption:=''; end else if a mod 13=10 then begin label1.Caption:=''; label2.Caption:=''; label3.Caption:=''; label4.Caption:='project'; end else
if a mod 13=11 then begin label1.Caption:=''; label2.Caption:=''; label3.Caption:=''; label4.Caption:=''; end else if a mod 13=12 then begin label1.Caption:='welcome'; label2.Caption:='to'; label3.Caption:='my'; label4.Caption:='project'; endend;
end.
2. Program Gen
const Codes64 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var gen: Tgen; i, x, a: integer; s1, s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12: string;
implementation
{$R *.dfm}
procedure Tgen.Button1Click(Sender: TObject);begins1 := Codes64; s2 := ''; for i := 0 to 5 do begin x := Random(Length(s1)); x := Length(s1) - x; s2 := s2 + s1[x]; s1 := Copy(s1, 3,x - 2) + Copy(s1, x + 5,Length(s1)); end; label1.caption:= s2;end;
procedure Tgen.Timer1Timer(Sender: TObject);begins1 := Codes64; s2 := ''; s3 := ''; s4 := '';
s5 := ''; s6 := ''; s7 := ''; s8 := ''; s9 := ''; s10 := ''; s11 := ''; s12 := '';
x := Random(Length(s1)); x := Length(s1) - x; s3 := s3 + s1[x]; s1 := Copy(s1, 2,x - 5) + Copy(s1, x + 1,Length(s1));
x := Random(Length(s1)); x := Length(s1) - x; s4 := s4 + s1[x]; s1 := Copy(s1, 2,x - 3) + Copy(s1, x + 1,Length(s1));
x := Random(Length(s1)); x := Length(s1) - x; s5 := s5 + s1[x]; s1 := Copy(s1, 2,x - 5) + Copy(s1, x + 1,Length(s1));
x := Random(Length(s1)); x := Length(s1) - x; s6 := s6 + s1[x]; s1 := Copy(s1, 2,x - 7) + Copy(s1, x + 1,Length(s1));
x := Random(Length(s1)); x := Length(s1) - x; s7 := s7 + s1[x]; s1 := Copy(s1, 2,x - 6) + Copy(s1, x + 1,Length(s1));
x := Random(Length(s1)); x := Length(s1) - x; s8 := s8 + s1[x]; s1 := Copy(s1, 2,x - 8) + Copy(s1, x + 1,Length(s1));
x := Random(Length(s1)); x := Length(s1) - x; s9 := s9 + s1[x]; s1 := Copy(s1, 2,x - 9) + Copy(s1, x + 1,Length(s1));
x := Random(Length(s1)); x := Length(s1) - x;
s10 := s10 + s1[x]; s1 := Copy(s1, 2,x - 1) + Copy(s1, x + 1,Length(s1));
x := Random(Length(s1)); x := Length(s1) - x; s11 := s12 + s1[x]; s1 := Copy(s1, 2,x - 14) + Copy(s1, x + 1,Length(s1));
x := Random(Length(s1)); x := Length(s1) - x; s12 := s12 + s1[x]; s1 := Copy(s1, 2,x - 16) + Copy(s1, x + 1,Length(s1));
label2.caption:= s3; label3.caption:= s4; label4.caption:= s5; label5.caption:= s6; label6.caption:= s7; label7.caption:= s8; label8.caption:= s9; label9.caption:= s10; label10.caption:= s11; label11.caption:= s12;
a:=a+1;
if a=1 then image2.visible:=true; if a=2 then image3.Visible:=true; if a=3 then image4.Visible:=true; if a=4 then image5.Visible:=true; if a=5 then begin image2.visible:=false; image3.Visible:=false; image4.Visible:=false; image5.Visible:=false; a:=0; end else begin if a=1 then image2.visible:=true; if a=2 then image3.Visible:=true; if a=3 then image4.Visible:=true; if a=4 then image5.Visible:=true; end;
end;
procedure Tgen.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;end.
3. Program Menu Awal
procedure Tawal.BangunDatar1Click(Sender: TObject);beginawal.Hide;materi_segi_empat.show;end;
procedure Tawal.BangunRuang1Click(Sender: TObject);beginawal.Hide;materi_bangun_ruang.show;end;
procedure Tawal.btopenClick(Sender: TObject);beginif opendialog1.Execute then begin
for i:=0 to opendialog1.Files.Count-1 do list.Items.Add(opendialog1.Files.Strings[i]); btstart.Enabled:=true; list.ItemIndex:=0; end;end;
procedure Tawal.btstartClick(Sender: TObject);beginif btstart.Caption = 'Start' then begin index:=list.itemindex; mp.FileName:=list.Items.Strings[index]; mp.Open; judul.Caption:=extractfilename(mp.FileName); judul.Left:=200; progress.Max:=mp.Length; mp.Play; timer1.Enabled:=true; progress.Enabled:=true; btstop.Enabled:=true; btstart.Caption:='Pause'; end else if btstart.Caption = 'Pause' then begin mp.Pause; btstart.Caption:='Play'; end else if btstart.Caption = 'Play' then begin mp.Pause; btstart.Caption:='Pause'; end elseend;
procedure Tawal.btstopClick(Sender: TObject);beginmp.Stop; timer1.Enabled:=false; judul.Left:=8; btstart.Caption:='Start';end;
procedure Tawal.DataMahsiswa1Click(Sender: TObject);beginawal.Hide;
data_mahasiswa.show;data_mahasiswa.ADOQuery1.Active:=true;end;
procedure Tawal.Exit1Click(Sender: TObject);beginapplication.Terminate;end;
procedure Tawal.FormClose(Sender: TObject; var Action: TCloseAction);beginmp.Close;end;
procedure Tawal.FormCreate(Sender: TObject);beginjudul.Caption:=''; timer1.Enabled:=false; btstart.Enabled:=false; btstop.Enabled:=false; progress.Enabled:=false;end;
procedure Tawal.Hapus1Click(Sender: TObject);beginlist.items.Delete(list.ItemIndex);end;
procedure Tawal.Kalkulator1Click(Sender: TObject);beginawal.Hide;kalkulator.show;end;
procedure Tawal.listDblClick(Sender: TObject);beginbtstart.Caption:='Start';btstart.OnClick(self);end;
procedure Tawal.Peluang1Click(Sender: TObject);beginawal.Hide;peluang.show;end;
procedure Tawal.progressScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer);beginmp.Position:=progress.Position; mp.Play;end;
procedure Tawal.Timer1Timer(Sender: TObject);beginjudul.Left:=judul.Left-1; if judul.Left = 0-judul.Width then judul.Left:=panel1.Width+1; if mp.position=mp.Length then begin if index + 1 =list.Items.Count then begin awal.btstop.OnClick(self); list.ItemIndex:=0; end else begin list.ItemIndex:=index+1; btstart.Caption:='Start'; btstart.OnClick(self); end; end;end;procedure Tawal.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
4. Program Materi Segi Empat
procedure TMateri_Segi_Empat.BelahKetupat1Click(Sender: TObject);beginmateri_segi_empat.Hide;Belah_ketupat.show;end;
procedure TMateri_Segi_Empat.JajarGenjang1Click(Sender: TObject);beginmateri_segi_empat.Hide;jajar_genjang.show;end;
procedure TMateri_Segi_Empat.Layanglayang1Click(Sender: TObject);beginmateri_segi_empat.Hide;layang_layang.show;end;
procedure TMateri_Segi_Empat.Menu1Click(Sender: TObject);beginmateri_segi_empat.Hide;awal.show;end;
procedure TMateri_Segi_Empat.Persegi1Click(Sender: TObject);beginmateri_segi_empat.Hide;persegi_panjang.show;end;
procedure TMateri_Segi_Empat.Persegi2Click(Sender: TObject);beginmateri_segi_empat.Hide;persegi.show;end;
procedure TMateri_Segi_Empat.rapesium1Click(Sender: TObject);beginmateri_segi_empat.Hide;trapesium.show;end;
procedure Tmateri_segi_empat.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
5. Program Persegi Panjang
procedure Tpersegi_panjang.BitBtn1Click(Sender: TObject);begin
a:= strtoint(edit1.Text);b:= strtoint(edit2.Text);c:=a*b;d:=2*(a+b);image1.Visible:=true;listbox1.Items.Add('Luas Persegi Panjang Tersebut Adalah' +floattostr(c));listbox1.Items.Add('Keliling Persegi Panjang Tersebut Adalah' +floattostr(d));end;
procedure Tpersegi_panjang.BitBtn2Click(Sender: TObject);beginedit1.Clear;edit2.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Tpersegi_panjang.Button1Click(Sender: TObject);beginpersegi_panjang.Hide;materi_segi_empat.show;end;
procedure Tpersegi_panjang.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;end.
6. Program Persegi
procedure TPersegi.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:=a*a;c:=4*a;image1.Visible:=true;listbox1.Items.Add('Luas Persegi Tersebut Adalah' +floattostr(b));listbox1.Items.Add('Keliling Persegi Tersebut Adalah' +floattostr(c));end;
procedure TPersegi.BitBtn2Click(Sender: TObject);beginedit1.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure TPersegi.Button1Click(Sender: TObject);beginpersegi.Hide;materi_segi_empat.show;end;
procedure Tpersegi.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;end.
7. Program Jajar Genjang
procedure Tjajar_genjang.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:= strtoint(edit2.Text);c:=a*b;
image1.Visible:=true;listbox1.Items.Add('Luas Jajar Genjang Tersebut Adalah' +floattostr(c));
end;
procedure Tjajar_genjang.BitBtn2Click(Sender: TObject);beginedit1.Clear;edit2.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Tjajar_genjang.Button1Click(Sender: TObject);beginjajar_genjang.Hide;materi_segi_empat.show;end;
procedure Tjajar_genjang.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
8. Program Belah Ketupat
procedure Tbelah_ketupat.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:= strtoint(edit2.Text);c:= strtoint(edit3.Text);d:=1/2*a*b;e:=4*c;image1.Visible:=true;listbox1.Items.Add('Luas Belah Ketupat Tersebut Adalah' +floattostr(d));listbox1.Items.Add('Keliling Belah Ketupat Tersebut Adalah' +floattostr(e));end;
procedure Tbelah_ketupat.BitBtn2Click(Sender: TObject);beginedit1.Clear;edit2.Clear;edit3.Clear;listbox1.Clear;
image1.Visible:=false;edit1.SetFocus;end;
procedure Tbelah_ketupat.Button1Click(Sender: TObject);beginbelah_ketupat.Hide;materi_segi_empat.show;end;
procedure Tbelah_ketupat.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
9. Program Layang-layang
procedure Tlayang_layang.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:= strtoint(edit2.Text);c:= strtoint(edit3.Text);d:= strtoint(edit4.Text);e:=1/2*a*b;f:=(2*c)+(2*d);
image1.Visible:=true;listbox1.Items.Add('Luas Layang-layang Tersebut Adalah' +floattostr(e));listbox1.Items.Add('Keliling Layang-layang Tersebut Adalah' +floattostr(f));end;
procedure Tlayang_layang.BitBtn2Click(Sender: TObject);beginedit1.Clear;edit2.Clear;edit3.Clear;edit4.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Tlayang_layang.Button1Click(Sender: TObject);beginlayang_layang.Hide;materi_segi_empat.show;end;
procedure Tlayang_layang.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
10. Program Trapeisum
procedure Ttrapesium.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:= strtoint(edit2.Text);c:= strtoint(edit3.Text);F:=a+b+c+d;e:=1/2*(b+c)*a;image1.Visible:=true;listbox1.Items.Add('Luas Trapesium Tersebut Adalah' +floattostr(e));listbox1.Items.Add('Keliling Trapesium Tersebut Adalah' +floattostr(f));end;
procedure Ttrapesium.BitBtn2Click(Sender: TObject);beginedit1.Clear;edit2.Clear;edit3.Clear;edit4.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Ttrapesium.Button1Click(Sender: TObject);begintrapesium.Hide;materi_segi_empat.show;end;
procedure Ttrapesium.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
11. Program Materi Bangun Ruang
procedure TMateri_bangun_ruang.BelahKetupat1Click(Sender: TObject);beginmateri_bangun_ruang.Hide;limas.show;end;
procedure TMateri_bangun_ruang.JajarGenjang1Click(Sender: TObject);beginmateri_bangun_ruang.Hide;prisma.show;end;
procedure TMateri_bangun_ruang.Layanglayang1Click(Sender: TObject);beginmateri_bangun_ruang.Hide;kerucut.show;end;
procedure TMateri_bangun_ruang.Menu1Click(Sender: TObject);beginmateri_bangun_ruang.Hide;bola.show;end;
procedure TMateri_bangun_ruang.Menu2Click(Sender: TObject);beginmateri_bangun_ruang.hide;awal.show;end;
procedure TMateri_bangun_ruang.Persegi1Click(Sender: TObject);
beginmateri_bangun_ruang.hide;balok.showend;
procedure TMateri_bangun_ruang.Persegi2Click(Sender: TObject);beginmateri_bangun_ruang.Hide;kubus.show;end;
procedure TMateri_bangun_ruang.rapesium1Click(Sender: TObject);beginmateri_bangun_ruang.Hide;tabung.show;end;
end.
12. Program Balok
procedure Tbalok.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:= strtoint(edit2.Text);c:= strtoint(edit3.Text);d:= a*b*c;e:= 2*((a*b)+(a*c)+(b*c));image1.Visible:=true;listbox1.Items.Add('Volume balok Tersebut Adalah' +floattostr(d));listbox1.Items.Add('Luas selimut Balok Tersebut Adalah' +floattostr(e));
end;
procedure Tbalok.BitBtn2Click(Sender: TObject);beginedit1.Clear;edit2.Clear;edit3.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Tbalok.Button1Click(Sender: TObject);beginbalok.Hide;materi_bangun_ruang.show;end;
procedure Tbalok.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
13. Program Kubus
procedure Tkubus.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);
b:=a*a*a;c:=6*a*a;image1.Visible:=true;listbox1.Items.Add('Volume Kubus Tersebut Adalah' +floattostr(b));listbox1.Items.Add('Luas Permukaan Kubus Tersebut Adalah' +floattostr(c));end;
procedure Tkubus.BitBtn2Click(Sender: TObject);beginedit1.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Tkubus.Button1Click(Sender: TObject);beginkubus.Hide;materi_bangun_ruang.show;end;
procedure Tkubus.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;end.
14. Program Prisma
procedure Tprisma.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:= strtoint(edit2.Text);c:= strtoint(edit3.Text);d:= strtoint(edit4.Text);;e:= 1/2*a*c;f:=a+b+c;edit5.Text:=floattostr(e);edit6.Text:=floattostr(f);g:= d*e;h:=(2*e)+f*d;image1.Visible:=true;listbox1.Items.Add('Volume Prisma Tersebut Adalah' +floattostr(g));listbox1.Items.Add('Luas Permukaan Prisma Tersebut Adalah' +floattostr(h));end;
procedure Tprisma.BitBtn2Click(Sender: TObject);beginedit1.Clear;edit2.Clear;edit3.Clear;edit4.Clear;edit5.Clear;edit6.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Tprisma.Button1Click(Sender: TObject);beginprisma.Hide;materi_bangun_ruang.show;end;
procedure Tprisma.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
15. Program Limas
procedure Tlimas.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:=strtoint(edit2.Text);c:=strtoint(edit3.Text);d:=1/2*a*b*c;e:=((a+b)*c)+(a*b);image1.Visible:=true;listbox1.Items.Add('Volume Kubus Tersebut Adalah' +floattostr(d));listbox1.Items.Add('Luas Permukaan Kubus Tersebut Adalah' +floattostr(e));end;
procedure Tlimas.BitBtn2Click(Sender: TObject);beginedit1.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Tlimas.Button1Click(Sender: TObject);beginlimas.Hide;materi_bangun_ruang.show;end;
procedure Tlimas.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) then
if Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
16. Program Kerucut
procedure Tkerucut.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:= strtoint(edit2.Text);c:= strtoint(edit3.Text);d:=22/7;e:= d*a*a;f:=d*a*c;edit5.Text:=floattostr(e);edit6.Text:=floattostr(f);g:= 1/3*d*a*a*b;h:=e+f;image1.Visible:=true;listbox1.Items.Add('Volume Kerucut Tersebut Adalah' +floattostr(g));listbox1.Items.Add('Luas Permukaan Kerucut Tersebut Adalah' +floattostr(h));end;
procedure Tkerucut.BitBtn2Click(Sender: TObject);beginedit1.Clear;edit2.Clear;edit3.Clear;
edit5.Clear;edit6.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Tkerucut.Button1Click(Sender: TObject);beginkerucut.Hide;materi_bangun_ruang.show;end;
procedure Tkerucut.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.17. Program Tabung
procedure Ttabung.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:= strtoint(edit2.Text);d:=22/7;e:= d*a*a;
f:=2*d*a*b;edit5.Text:=floattostr(e);edit6.Text:=floattostr(f);g:= 1/4*d*a*a*b;h:=(2*e)+f;image1.Visible:=true;listbox1.Items.Add('Volum Tabung Tersebut Adalah' +floattostr(g));listbox1.Items.Add('Luas Permukaan Tabung Tersebut Adalah' +floattostr(h));end;
procedure Ttabung.BitBtn2Click(Sender: TObject);beginedit1.Clear;edit2.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Ttabung.Button1Click(Sender: TObject);begintabung.Hide;materi_bangun_ruang.show;end;
procedure Ttabung.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
18. Program bola
procedure Tbola.BitBtn1Click(Sender: TObject);begina:= strtoint(edit1.Text);b:= 22/7;c:=4/3*b*a*a*a;d:=4*b*a*a;image1.Visible:=true;listbox1.Items.Add('Volume Bola Tersebut Adalah' +floattostr(b));listbox1.Items.Add('Luas Selimut Bola Tersebut Adalah' +floattostr(c));end;
procedure Tbola.BitBtn2Click(Sender: TObject);beginedit1.Clear;listbox1.Clear;image1.Visible:=false;edit1.SetFocus;end;
procedure Tbola.Button1Click(Sender: TObject);beginbola.Hide;materi_bangun_ruang.show;end;
procedure Tbola.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) then
if Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
19. Program Peluang
a. Permutasi
b. Kombinasi
procedure TPeluang.BitBtn1Click(Sender: TObject);beginif RBpermutasi.Checked then begin n := strtoint(edit1.Text); fakt1:=1; for a := 2 to n do fakt1:=fakt1*a; edit3.text:=inttostr(fakt1);
k := strtoint(edit2.Text); fakt2:=1; for b := 2 to k do fakt2:=fakt2*b; edit4.text:=inttostr(fakt2);
if n>k then begin nminusk:=n-k; fakt3:=1; for c := 2 to NminusK do fakt3:=fakt3*c; edit5.text:=inttostr(fakt3); d:=fakt1/fakt3; listbox1.Items.Add(inttostr(n)+' Permutasi '+inttostr(K)+ ' = ' +floattostr(d)); end else if n<k then begin e:=n-k;; edit5.Text:='Tidak Terdefinisi'; listbox1.Items.Add('banyaknya permutasi tidak terdefinisi'); listbox1.Items.Add('karena ( '+inttostr(n)+'-'+inttostr(K)+ ') = '+floattostr(e)+ ' maka tidak terdefinisikan'); end endelseif RBkombinasi.Checked then begin n := strtoint(edit1.Text); fakt1:=1; for a := 2 to n do fakt1:=fakt1*a; edit3.text:=inttostr(fakt1);
r := strtoint(edit2.Text);
fakt2:=1; for b := 2 to r do fakt2:=fakt2*b; edit4.text:=inttostr(fakt2); if n>r then begin nminusR:=n-r; fakt3:=1; for c := 2 to NminusR do fakt3:=fakt3*c; edit5.text:=inttostr(fakt3); d:=fakt1/(fakt3*fakt2); listbox1.Items.Add(inttostr(n)+' kombinasi '+inttostr(r)+ ' = ' +floattostr(d)); end endelseif n<r then begin e:=n-r;; edit5.Text:='Tidak Terdefinisi'; listbox1.Items.Add('banyaknya kombinasi tidak terdefinisi'); listbox1.Items.Add('karena ('+inttostr(n)+'-'+inttostr(r)+ ') = '+floattostr(e)+ 'maka tidak terdefinisikan'); end
end;
procedure TPeluang.BitBtn2Click(Sender: TObject);beginedit1.clear;edit2.clear;edit3.clear;edit4.clear;edit5.clear;listbox1.clear;edit1.setfocus;end;
procedure TPeluang.Button1Click(Sender: TObject);beginedit1.clear;edit2.clear;edit3.clear;edit4.clear;edit5.clear;listbox1.clear;
edit1.setfocus;edit1.Visible:=false;edit2.Visible:=false;edit3.Visible:=false;edit4.Visible:=false;edit5.Visible:=false;image1.Visible:=false;image2.Visible:=false;label1.Visible:=false;label2.Visible:=false;label3.Visible:=false;label4.Visible:=false;label5.Visible:=false;label6.Visible:=false;BitBtn1.Visible:=false;BitBtn2.Visible:=false;Button1.Visible:=false;groupbox1.Visible:=false;listbox1.Visible:=false;panel1.Show;image3.Show;
end;
procedure TPeluang.RBexitClick(Sender: TObject);beginpeluang.Hide;awal.show;end;
procedure TPeluang.RBkombinasiClick(Sender: TObject);beginpanel1.Hide;image3.Hide;peluang.Color:=cllime;label1.Caption:='KOMBINASI';label2.Caption:='Bilangan Pertama atau n';label3.Caption:='Bilangan Kedua atau r';label4.Caption:='Faktorial n atau n!';label5.Caption:='Faktorial r atau r!';label6.Caption:='Faktorial (n-r) atau (n-r)!';edit1.Visible:=true;edit2.Visible:=true;edit3.Visible:=true;edit4.Visible:=true;edit5.Visible:=true;
image1.SendToBack;image2.BringToFront;image2.Visible:=true;label1.Visible:=true;label2.Visible:=true;label3.Visible:=true;label4.Visible:=true;label5.Visible:=true;label6.Visible:=true;BitBtn1.Visible:=true;BitBtn2.Visible:=true;Button1.Visible:=true;groupbox1.Visible:=true;listbox1.Visible:=true;end;
procedure TPeluang.RBpermutasiClick(Sender: TObject);beginpanel1.Hide;image3.Hide;peluang.Color:=clinactivecaption;label1.Caption:='PERMUTASI';label2.Caption:='Bilangan Pertama atau N';label3.Caption:='Bilangan Kedua atau K';label4.Caption:='Faktorial N atau N!';label5.Caption:='Faktorial K atau K!';label6.Caption:='Faktorial (N-K) atau (N-K)!';edit1.Visible:=true;edit2.Visible:=true;edit3.Visible:=true;edit4.Visible:=true;edit5.Visible:=true;image2.SendToBack;image1.BringToFront;image1.Visible:=true;label1.Visible:=true;label2.Visible:=true;label3.Visible:=true;label4.Visible:=true;label5.Visible:=true;label6.Visible:=true;BitBtn1.Visible:=true;BitBtn2.Visible:=true;Button1.Visible:=true;groupbox1.Visible:=true;listbox1.Visible:=true;
end;
procedure Tpeluang.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.20. Program Kalkulator
procedure Tkalkulator.Button1Click(Sender: TObject);beginpanel1.Caption:='0';end;
procedure Tkalkulator.Button20Click(Sender: TObject);beginif MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption));
if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka))));MemAngka:=panel1.Caption;MemLogic:='0';end;
procedure Tkalkulator.Button21Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then if MemLogic='0' then MemOperator:='x' else if (MemOperator='') then begin MemOperator:='sin'; MemLogic:='0'; MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180)));
if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); MemOperator:='sin'; MemLogic:='0'; end;end;
procedure Tkalkulator.Button22Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then if MemLogic='0' then MemOperator:='x' else if (MemOperator='') then begin MemOperator:='cos'; MemLogic:='0'; MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); MemOperator:='cos'; MemLogic:='0'; end;end;
procedure Tkalkulator.Button23Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then if MemLogic='0' then MemOperator:='x' else if (MemOperator='') then begin MemOperator:='tan'; MemLogic:='0'; MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); MemOperator:='tan'; MemLogic:='0'; end;end;
procedure Tkalkulator.Button2Click(Sender: TObject);beginkalkulator.Hide;awal.show;end;
procedure Tkalkulator.Button3Click(Sender: TObject);beginif panel1.Caption='0' then
panel1.Caption:='';if panel1.Caption<>' ' thenif MemLogic='0' then begin MemLogic:='1'; if MemOperator<>'' then panel1.Caption:='1' elsepanel1.Caption:='1'; endelse panel1.Caption:=panel1.Caption+'1';end;
procedure Tkalkulator.Button4Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';if panel1.Caption<>' ' thenif MemLogic='0' then begin MemLogic:='2'; if MemOperator<>'' then panel1.Caption:='2' elsepanel1.Caption:='2'; endelse panel1.Caption:=panel1.Caption+'2';end;
procedure Tkalkulator.Button5Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';if panel1.Caption<>' ' thenif MemLogic='0' then begin MemLogic:='3'; if MemOperator<>'' then panel1.Caption:='3' elsepanel1.Caption:='3'; endelse panel1.Caption:=panel1.Caption+'3';end;
procedure Tkalkulator.Button6Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';
if panel1.Caption<>' ' thenif MemLogic='0' then begin MemLogic:='4'; if MemOperator<>'' then panel1.Caption:='4' elsepanel1.Caption:='4'; endelse panel1.Caption:=panel1.Caption+'4';end;
procedure Tkalkulator.Button7Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';if panel1.Caption<>' ' thenif MemLogic='0' then begin MemLogic:='5'; if MemOperator<>'' then panel1.Caption:='5' elsepanel1.Caption:='5'; endelse panel1.Caption:=panel1.Caption+'5';end;
procedure Tkalkulator.Button8Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';if panel1.Caption<>' ' thenif MemLogic='0' then begin MemLogic:='6'; if MemOperator<>'' then panel1.Caption:='6' elsepanel1.Caption:='6'; endelse panel1.Caption:=panel1.Caption+'6';end;
procedure Tkalkulator.Button9Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';if panel1.Caption<>' ' then
if MemLogic='0' then begin MemLogic:='7'; if MemOperator<>'' then panel1.Caption:='7' elsepanel1.Caption:='7'; endelse panel1.Caption:=panel1.Caption+'7';end;procedure Tkalkulator.ColorBox1Change(Sender: TObject);begingroupbox2.color:=colorbox1.Selected;end;
procedure Tkalkulator.BitBtn1Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then if MemLogic='0' then MemOperator:='x' else if (MemOperator='') then begin MemOperator:='akar'; MemLogic:='0'; MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka))));
MemOperator:='akar'; MemLogic:='0'; end;end;
procedure Tkalkulator.BitBtn2Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then if MemLogic='0' then MemOperator:='x' else if (MemOperator='') then begin MemOperator:='kuadrat'; MemLogic:='0'; MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); MemOperator:='kuadrat'; MemLogic:='0'; end;end;
procedure Tkalkulator.BitBtn3Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then
if MemLogic='0' then MemOperator:='x' else if (MemOperator='') then begin MemOperator:='pangkat'; MemLogic:='0'; MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); MemOperator:='pangkat'; MemLogic:='0'; end;end;
procedure Tkalkulator.Button10Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';if panel1.Caption<>' ' thenif MemLogic='0' then begin MemLogic:='8'; if MemOperator<>'' then panel1.Caption:='8' elsepanel1.Caption:='8'; endelse panel1.Caption:=panel1.Caption+'8';
end;procedure Tkalkulator.Button11Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';if panel1.Caption<>' ' thenif MemLogic='0' then begin MemLogic:='9'; if MemOperator<>'' then panel1.Caption:='9' elsepanel1.Caption:='9'; endelse panel1.Caption:=panel1.Caption+'9';end;procedure Tkalkulator.Button12Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';if panel1.Caption<>' ' thenif MemLogic='0' then begin MemLogic:='0'; if MemOperator<>'' then panel1.Caption:='0' elsepanel1.Caption:='0'; endelse panel1.Caption:=panel1.Caption+'0';end;
procedure Tkalkulator.Button13Click(Sender: TObject);beginif panel1.Caption='0' thenpanel1.Caption:='';if panel1.Caption<>' ' thenif MemLogic=',' then begin MemLogic:=','; if MemOperator<>'' then panel1.Caption:=',' elsepanel1.Caption:=','; endelse panel1.Caption:=panel1.Caption+',';end;
procedure TKalkulator.Button14Click(Sender: TObject);
beginpanel1.caption:=floattostr(strtofloat(panel1.caption)*(-1));end;
procedure Tkalkulator.Button15Click(Sender: TObject);beginpanel1.Caption:='0';end;
procedure Tkalkulator.Button16Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then if MemLogic='0' then MemOperator:='+' else if (MemOperator='') then begin MemOperator:='+'; MemLogic:='0'; MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); MemOperator:='+'; MemLogic:='0'; end;end;
procedure Tkalkulator.Button17Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then if MemLogic='0' then MemOperator:='-' else if (MemOperator='') then begin MemOperator:='-'; MemLogic:='0'; MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); MemOperator:='-'; MemLogic:='0'; end;end;
procedure Tkalkulator.Button18Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then if MemLogic='0' then MemOperator:='x' else if (MemOperator='') then begin MemOperator:='x'; MemLogic:='0';
MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption)); if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka)));if MemOperator='akar' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); MemOperator:='x'; MemLogic:='0'; end;end;
procedure Tkalkulator.Button19Click(Sender: TObject);beginMemOperator:='';if (panel1.Caption<>'') then if MemLogic='0' then MemOperator:='/' else if (MemOperator='') then begin MemOperator:='/'; MemLogic:='0'; MemAngka:=panel1.Caption; end else begin if MemOperator='+' then panel1.Caption:=floattostr(strtofloat(MemAngka)+strtofloat(panel1.Caption));
if MemOperator='-' then panel1.Caption:=floattostr(strtofloat(MemAngka)-strtofloat(panel1.Caption)); if MemOperator='x' then panel1.Caption:=floattostr(strtofloat(MemAngka)*strtofloat(panel1.Caption)); if MemOperator='/' then panel1.Caption:=floattostr(strtofloat(MemAngka)/strtofloat(panel1.Caption)); if MemOperator='sin' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))); if MemOperator='cos' then panel1.Caption:=floattostr(cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='tan' then panel1.Caption:=floattostr(sin(strtofloat(MemAngka)*(pi/180))/cos(strtofloat(MemAngka)*(pi/180))); if MemOperator='kuadrat' then panel1.Caption:=floattostr(sqr(strtofloat(MemAngka))); if MemOperator='akar' then panel1.Caption:=floattostr(sqrt(strtofloat(MemAngka))); if MemOperator='pangkat' then panel1.Caption:=floattostr(exp(strtofloat(panel1.Caption)*ln(strtofloat(MemAngka)))); MemOperator:='/'; MemLogic:='0'; end;end;
procedure Tkalkulator.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
21. Program Data Mahasiswa
procedure Tdata_mahasiswa.Cari1Click(Sender: TObject);beginData_mahasiswa.Hide;individu.show;end;
procedure Tdata_mahasiswa.Exi1Click(Sender: TObject);begindata_mahasiswa.Hide;awal.show;end;
procedure Tdata_mahasiswa.InputData1Click(Sender: TObject);begindata_mahasiswa.hide;tambah.show;tambah.edit1.setfocus;end;
procedure TData_mahasiswa.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;
end;22. Program Input
procedure Ttambah.BitBtn1Click(Sender: TObject);var foto,fotopengguna,msql:string;begindata_mahasiswa.Timer1.Enabled:=true; foto:=tambah.openpicture.FileName; if length(trim(foto))<>0 then fotopengguna:=tambah.openpicture.FileName else fotopengguna:=''; //end; tambah.tbbiodata.Edit; Data_mahasiswa.ADOConnection1.Connected:=False; ADS.Active:=False; TbBiodata.Active:=False; Data_mahasiswa.ADOConnection1.Connected:=True; mSql:='insert into bio values('+ '"'+tambah.edit1.Text+'",'+ '"'+tambah.Edit2.Text+'",'+ '"'+tambah.Edit3.Text+'",'+ '"'+tambah.Edit4.Text+'",'+ '"'+tambah.Edit5.Text+'",'+ '"'+tambah.Edit6.Text+'",'+ '"'+foto+'")';
AC.CommandText:=msql; AC.Execute; TbBiodata.Active:=True;
tambah.edit1.Text:=''; tambah.edit2.Text:=''; tambah.edit3.Text:=''; tambah.Edit4.Text:=''; tambah.edit6.Text:='';
edit1.SetFocus; tambah.Hide; data_mahasiswa.show; Data_mahasiswa.ADOConnection1.Connected:=True; data_mahasiswa.ADOQuery1.Active:=true;end;
procedure Ttambah.BitBtn2Click(Sender: TObject);begin edit1.Text:=''; edit2.Text:=''; edit3.Text:=''; Edit4.Text:=''; Edit6.Text:=''; edit1.SetFocus;tambah.hide;data_mahasiswa.show;end;
procedure Ttambah.BitBtn3Click(Sender: TObject);beginif openpicture.Execute thenbeginImage2.Visible:=true;Image2.Picture.LoadFromFile(openpicture.filename);end;end;
procedure Ttambah.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;end.
23. Program Search
procedure Tindividu.BitBtn1Click(Sender: TObject);begin N[i]:=inputbox('ID','NIM',''); NIM.Text:= N[i];
If data=0 Then data_mahasiswa.ADOQuery1.First Else data_mahasiswa.ADOQuery1.Next; While Not data_mahasiswa.ADOQuery1.EOF Do begin data:= Pos(UpperCase(NIM.Text), UpperCase(data_mahasiswa.ADOQuery1.FieldbyName('NIM').AsString)); If data > 0 Then break; data_mahasiswa.ADOQuery1.Next; end;if data_mahasiswa.ADOQuery1.FieldByName('NIM').AsString=NIM.Text then begin no.Text:=data_mahasiswa.ADOQuery1['No']; nim.Text:=data_mahasiswa.ADOQuery1['NIM']; nama.Text:=data_mahasiswa.aDOQuery1['Nama']; tempattanggallahir.Text:=data_mahasiswa.ADOQuery1['Tempat,Tanggal Lahir']; Alamat.Text:=data_mahasiswa.ADOQuery1['Alamat']; NotelpHP.Text:=data_mahasiswa.ADOQuery1['No,tlp/Hp'];
foto.Text:=data_mahasiswa.ADOQuery1['foto'];
GroupBox1.Visible:=True;end;
end;
procedure Tindividu.BitBtn2Click(Sender: TObject);beginindividu.hide;Data_mahasiswa.Show;end;
procedure Tindividu.Timer1Timer(Sender: TObject);beginif Nama.Text>'0' then begintimer1.Enabled:=true;individu.Image2.Visible:=True;individu.Image2.Picture.LoadFromFile(data_mahasiswa.ADOQuery1.Fields[6].AsString);end else begin timer1.Enabled:=false; if Nama.Text='' then begintimer1.Enabled:=true;individu.Image2.Visible:=true;end;end;end;
procedure TIndividu.WMNCHitTest(var msg : TWMNCHitTest);begininherited;if (msg.Result = htClient) thenif Msg.YPos < Top + 1000 thenmsg.Result := htCaption;end;
end.
Top Related