Sabtu, 26 Desember 2015
Umur
procedure TForm2.Button1Click(Sender: TObject);
var a:integer ;
begin
a:=StrToInt(Edit1.Text);
if a > 150 then
Edit2.Text := 'Calon2 Penghuni KU**R'
else
if a > 110 then
Edit2.Text := 'Bersiaplah'
else
if a > 60 then
Edit2.Text := 'Manula'
else
if a > 20 then
Edit2.Text := 'Dewasa'
else
if a > 12 then
Edit2.Text := 'Remaja'
else
if a > 5 then
Edit2.Text := 'Anak-Anak'
else
if a > 2 then
Edit2.Text := 'Balita'
else
if a > 1 then
Edit2.Text := 'Batita'
else
Edit2.Text := 'Kandungan';
end;
Rumus Perkalian 1-10
procedure TForm2.Button1Click(Sender: TObject);
var i,j,k : integer ;
begin
Memo1.Clear ;
for I := 1 to 10 do begin
for j := 1 to 10 do begin
k := j*i ;
Memo1.Lines.Add(IntToStr(j)+' x '+IntToStr(i) +' = '+IntToStr(k) ) ;
end;
Memo1.Lines.Add('') ;
Memo1.Lines.Add('') ;
end;
end;
Posisi Cursor
procedure TForm2.Timer1Timer(Sender: TObject);
begin
Edit1.Text := inttostr(Mouse.CursorPos.X) ;
Edit2.Text := inttostr(Mouse.CursorPos.Y) ;
end;
Penilaian Mahasiswa
procedure TForm2.Button1Click(Sender: TObject);
var mid,finall,hadir,total : real ;
begin
mid := StrTofloat(Edit1.Text) * 0.3 ;
finall := StrTofloat(Edit1.Text) * 0.5 ;
hadir := StrTofloat(Edit1.Text) * 0.2 ;
total := mid + finall + hadir;
if total > 85 then
Edit4.Text := 'A'
else if total > 75 then
Edit4.Text := 'B'
else if total > 65 then
Edit4.Text := 'C'
else if total > 55 then
Edit4.Text := 'D'
else
Edit4.Text := 'E'
end;
Pengingat
procedure TForm2.Button1Click(Sender: TObject);
begin
Timer1.Enabled := true ;
end;
procedure TForm2.Timer1Timer(Sender: TObject);
var A:tform;
begin
Edit2.Text := FormatDateTime('HH:MM:SS AM/PM',now) ;
if FormatDateTime('H:MM:SS AM/PM',now)=timetostr(DateTimePicker1.Time) then begin
ShowMessage(Edit1.Text) ;
Timer1.Enabled := false ;
end;
Parkiran
procedure TForm2.Button1Click(Sender: TObject);
var Total :integer ;
begin
if RadioButton1.Checked = true then begin
total := 2000 * StrToInt(edit1.Text);
Edit2.Text := IntToStr(total) ;
end
else
if RadioButton2.Checked = true then begin
total := 1000 * StrToInt(edit1.Text) ;
Edit2.Text := IntToStr(total) ;
end else
showmessage('Isi Yang benar') ;
end;
procedure TForm2.Button2Click(Sender: TObject);
var bayar , total,sisa : integer ;
begin
bayar := strtoint(edit3.Text) ;
total := strtoint(edit2.Text) ;
if bayar >= total then begin
sisa := bayar - total ;
end else
showmessage('Pembayaran Kurang') ;
end;
Mp3 Sederhana
procedure TForm2.Button1Click(Sender: TObject);
begin
OpenDialog1.Execute;
if OpenDialog1.Files.Count > 0 then begin
if ExtractFileExt(OpenDialog1.FileName) = '.mp3' then
begin
MediaPlayer1.FileName := OpenDialog1.FileName ;
MediaPlayer1.Open ;
Button2.Enabled := true ;
Button3.Enabled := true ;
end else
begin
Button2.Enabled := false ;
Button3.Enabled := false ;
end;
end else begin
Button2.Enabled := false ;
Button3.Enabled := false ;
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
Button1.Caption := 'Open' ;
Button2.Caption := 'Play' ;
Button3.Caption := 'Pause' ;
Button2.Enabled := false ;
Button3.Enabled := false ;
end;
Langganan:
Postingan (Atom)