Snippet

Contoh Program Rental




procedure TForm1.Button1Click(Sender: TObject);
const//membuat suatu nilai constanta
HargaRental=3500;
HargaNasGor=3500;
HargaCocaCola=1250;
HargaTehBotol=1000;
var
Lama : real;
TotalRental, TotalMakanMinum, GrandTotal, TotalNasgor, TotalCocaCola, TotalTehBotol:Real;
begin
Lama :=  StrtoFloat(Edit1.Text);
TotalRental:=Lama * HargaRental;

if Checkbox1.checked = true then
TotalNasgor:=StrtoFloat (Edit2.Text) * HargaNasgor
else
TotalNasgor:=0;

if Checkbox2.checked =true then
TotalCocaCola:=StrtoFloat (Edit3.Text) * HargaCocaCola
else
TotalCocaCola:=0;

if Checkbox3.checked = true then
TotalTehBotol:=StrtoFloat (Edit4.Text) * HargaTehBotol
else
TotalTehBotol:=0;

TotalMakanMinum:= TotalNasgor + TotalCocaCola + TotalTehBotol;
GrandTotal:= TotalRental + TotalMakanMinum;

Edit5.Text:=Floattostr (TotalRental);
Edit6.Text:=floattostr (TotalMakanMinum);
edit7.Text:=floattostr (GrandTotal);





end;

end.

Leave a Reply

diooda