Sesudah Run
Listing Program
unit tugas;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
eharga: TEdit;
GroupBox1: TGroupBox;
Label6: TLabel;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
efasilitas: TEdit;
GroupBox2: TGroupBox;
Label7: TLabel;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
eminuman: TEdit;
GroupBox3: TGroupBox;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
ejumbel: TEdit;
etotal: TEdit;
eubay: TEdit;
ekembali: TEdit;
Button1: TButton;
Button2: TButton;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
List1: TListBox;
bhitung: TButton;
Button3: TButton;
jml: TEdit;
procedure ComboBox2Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure bhitungClick(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure ejumbelKeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure eubayKeyPress(Sender: TObject; var Key: Char);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
a,b,c:real;
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ComboBox2Click(Sender: TObject);
begin
list1.clear;
if combobox1.text='Sarapan Pagi' then
begin
if combobox2.text='Paket1' then
begin
list1.clear;
list1.items.add('Nasi uduk');
list1.items.add('Telor');
list1.items.add('Tempe orek');
eharga.Text:='5000';
end
else
begin
list1.clear;
list1.items.add('Nasi goreng');
list1.items.add('Telur Mata sapi');
list1.items.add('Kerupik');
eharga.Text:='7000';
end
end
else
if combobox1.text='Makan Siang' then
begin
if combobox2.ItemIndex=0 then
begin
list1.clear;
list1.items.add('Nasi Putih');
list1.items.add('Ayam Bakar');
list1.items.add('Lalapan');
eharga.Text:='8000';
end
else
begin
list1.clear;
list1.items.add('Nasi putih');
list1.items.add('Rendang');
list1.items.add('Sayur');
eharga.Text:='10000';
end
end
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
if radiobutton1.Checked=true then
efasilitas.Text:='5000';
end;
procedure TForm1.bhitungClick(Sender: TObject);
begin
c:=(a+b);
eminuman.text:=floattostr(c);
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if checkbox1.Checked=true then
a:=3000
else
a:=0;
end;
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
if checkbox2.Checked=true then
b:=1500
else
b:=0;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
if radiobutton2.Checked=true then
efasilitas.Text:='0';
end;
procedure TForm1.ejumbelKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
etotal.Text:=floattostr(strtofloat(ejumbel.Text)*strtofloat(jml.Text));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
combobox1.text:='Silahkan pilih';
combobox2.text:='pilih Paket';
eharga.Text:='0';
list1.clear;
efasilitas.Text:='0';
eminuman.Text:='0';
ejumbel.Text:='0';
etotal.Text:='0';
ekembali.text:='0';
eubay.Text:='0';
checkbox1.Checked:=false ;
checkbox2.Checked:=false ;
radiobutton1.Checked:=false;
radiobutton2.Checked:=false
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if(application.MessageBox('anda yakin akan keluar','informasi',MB_YESNO)=IDYES)then
close;
end;
procedure TForm1.eubayKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
ekembali.Text:=floattostr(strtofloat(eubay.Text)-strtofloat(etotal.Text));
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
jml.Text:=floattostr(strtofloat(eharga.Text)+strtofloat(efasilitas.Text)+strtofloat(eminuman.Text));
end;
end.
Terima Kasih