Tampilan Program |
Coding program :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Label4: TLabel;
ListBox1: TListBox;
Label5: TLabel;
eharga: TEdit;
GroupBox2: TGroupBox;
Label7: TLabel;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
efasilitas: TEdit;
GroupBox1: TGroupBox;
Label6: TLabel;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
eminuman: TEdit;
hitung: TButton;
GroupBox3: TGroupBox;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
etotal: TEdit;
eubay: TEdit;
ekembali: TEdit;
input: TButton;
keluar: TButton;
ejumlbel: TEdit;
procedure ComboBox2Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure hitungClick(Sender: TObject);
procedure ejumlbelKeyPress(Sender: TObject; var Key: Char);
procedure eubayChange(Sender: TObject);
procedure keluarClick(Sender: TObject);
procedure inputClick(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
listbox1.Clear;
if combobox1.Text = 'sarapan pagi' then
begin
if combobox2.Text ='paket1' then
begin
listbox1.Clear;
listbox1.Items.Add('nasi uduk');
listbox1.Items.Add('telor');
listbox1.Items.Add('tempe orek');
eharga.Text :='5000';
end
else
begin
listbox1.Clear;
listbox1.Items.Add('nasi goreng');
listbox1.Items.Add('telur mata sapi');
listbox1.Items.Add('kerupuk');
eharga.Text :='7000';
end
end
else
begin
listbox1.Clear;
if combobox1.Text = 'makan siang' then
begin
if combobox2.Text ='paket1' then
begin
listbox1.Clear;
listbox1.Items.Add('nasi putih');
listbox1.Items.Add('ayam bakar');
listbox1.Items.Add('lalapan');
eharga.Text :='8000';
end
else
begin
listbox1.Clear;
listbox1.Items.Add('nasi putih');
listbox1.Items.Add('rendang');
listbox1.Items.Add('sayur');
eharga.Text :='10000';
end
end
end;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
efasilitas.Text :='5000';
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
efasilitas.Text :='0';
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if checkbox1.Checked then
a:=3000
else
a:=0;
end;
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
if checkbox2.Checked then
b:=1000
else
b:=0;
end;
procedure TForm1.hitungClick(Sender: TObject);
begin
c:=a+b;
eminuman.Text :=floattostr(c);
end;
procedure TForm1.ejumlbelKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
etotal.Text :=floattostr(strtofloat(eharga.Text)+strtofloat(efasilitas.Text)+strtofloat(eminuman.Text));
end;
procedure TForm1.eubayChange(Sender: TObject);
begin
ekembali.Text :=currtostr(strtocurr(eubay.Text)-strtocurr(etotal.Text ));
end;
procedure TForm1.keluarClick(Sender: TObject);
begin
close;
end;
procedure TForm1.inputClick(Sender: TObject);
begin
combobox1.Text :='pilih jenis makanan';
combobox2.Text :='pilih paket';
listbox1.Clear ;
eharga.Text :='0';
radiobutton1.Checked := false;
radiobutton2.Checked :=false;
efasilitas.Text :='0';
checkbox1.Checked :=false;
checkbox2.Checked :=false;
eminuman.Text :='0';
ejumlbel.Text :='0';
etotal.Text :='0';
eubay.Text :='0';
ekembali.Text :='0';
end;
procedure TForm3.FormActivate(Sender: TObject);
begin
edit1.Text:='Galih Rakasiwi';
edit8.Text:='12.4H.03';
edit9.Text:='12094545';
end;
end.