Advertisement
rikokurniawan

Kecepatan, Jarak, Waktu

Dec 29th, 2012
1,018
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 6.40 KB | None | 0 0
  1. {
  2. Created By Jean Riko Kurniawan Putra
  3. Programmer Delphi Di Delphi Anime Lover
  4. BLOG : djeansoftware.blogspot.com
  5. Fanpage : www.facebook.com/jean.software
  6. }
  7. unit UKJW;
  8.  
  9. interface
  10.  
  11. uses
  12.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  13.   Dialogs, ComCtrls, StdCtrls;
  14.  
  15. type
  16.   TFKJW = class(TForm)
  17.     PageControl1: TPageControl;
  18.     TabSheet1: TTabSheet;
  19.     TabSheet2: TTabSheet;
  20.     TabSheet3: TTabSheet;
  21.     GroupBox1: TGroupBox;
  22.     Label1: TLabel;
  23.     Label2: TLabel;
  24.     Label3: TLabel;
  25.     Label4: TLabel;
  26.     LHasil: TLabel;
  27.     EJarak: TEdit;
  28.     EWaktu: TEdit;
  29.     Button1: TButton;
  30.     Button2: TButton;
  31.     Button3: TButton;
  32.     Combobox1: TComboBox;
  33.     ComboBox2: TComboBox;
  34.     GroupBox2: TGroupBox;
  35.     Label5: TLabel;
  36.     Label6: TLabel;
  37.     Label7: TLabel;
  38.     Label8: TLabel;
  39.     Label9: TLabel;
  40.     Edit1: TEdit;
  41.     EKecepatan: TEdit;
  42.     Button4: TButton;
  43.     Button5: TButton;
  44.     Button6: TButton;
  45.     ComboBox3: TComboBox;
  46.     ComboBox4: TComboBox;
  47.     GroupBox3: TGroupBox;
  48.     Label10: TLabel;
  49.     Label11: TLabel;
  50.     Label12: TLabel;
  51.     Label13: TLabel;
  52.     Label14: TLabel;
  53.     Edit2: TEdit;
  54.     Edit3: TEdit;
  55.     Button7: TButton;
  56.     Button8: TButton;
  57.     Button9: TButton;
  58.     ComboBox5: TComboBox;
  59.     ComboBox6: TComboBox;
  60.     procedure TabSheet1Show(Sender: TObject);
  61.     procedure TabSheet3Show(Sender: TObject);
  62.     procedure TabSheet2Show(Sender: TObject);
  63.     procedure Button1Click(Sender: TObject);
  64.     procedure EJarakKeyPress(Sender: TObject; var Key: Char);
  65.     procedure EWaktuKeyPress(Sender: TObject; var Key: Char);
  66.     procedure Edit2KeyPress(Sender: TObject; var Key: Char);
  67.     procedure Edit3KeyPress(Sender: TObject; var Key: Char);
  68.     procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  69.     procedure EKecepatanKeyPress(Sender: TObject; var Key: Char);
  70.     procedure Button3Click(Sender: TObject);
  71.     procedure FormShow(Sender: TObject);
  72.     procedure Button7Click(Sender: TObject);
  73.     procedure Button4Click(Sender: TObject);
  74.   private
  75.     { Private declarations }
  76.   public
  77.     { Public declarations }
  78.   end;
  79.  
  80. var
  81.   FKJW: TFKJW;
  82.  
  83. implementation
  84.  
  85. {$R *.dfm}
  86.  
  87. procedure TFKJW.TabSheet1Show(Sender: TObject);
  88. begin
  89.   LHasil.Caption:='0';
  90.   EJarak.SetFocus;
  91. end;
  92.  
  93. procedure TFKJW.TabSheet3Show(Sender: TObject);
  94. begin
  95.   Label9.Caption:='0';
  96.   Edit1.SetFocus;
  97. end;
  98.  
  99. procedure TFKJW.TabSheet2Show(Sender: TObject);
  100. begin
  101.   Label14.Caption:='0';
  102.   Edit2.SetFocus;
  103. end;
  104.  
  105. procedure TFKJW.Button1Click(Sender: TObject);
  106. Var
  107.   a,b:Real;
  108. begin
  109.   a:=StrToFloat(EJarak.Text);
  110.   b:=StrToFloat(EWaktu.Text);
  111.   If (Combobox1.ItemIndex=0) And
  112.     (ComboBox2.ItemIndex=0) then
  113.     Begin
  114.       LHasil.Caption:=FloatToStr(a/b) + ' Km/Jam' ;
  115.     End
  116.   Else If (Combobox1.ItemIndex=0) And
  117.     (ComboBox2.ItemIndex=1) then
  118.     Begin
  119.       LHasil.Caption:=FloatToStr(a/(b/60)) + ' Km/Jam' ;
  120.     End
  121.   Else If (Combobox1.ItemIndex=0) And
  122.     (ComboBox2.ItemIndex=2) then
  123.     Begin
  124.       LHasil.Caption:=FloatToStr(a/(b/3600)) + ' Km/Jam' ;
  125.     End
  126.   Else If (Combobox1.ItemIndex=1) And
  127.     (ComboBox2.ItemIndex=0) then
  128.     Begin
  129.       LHasil.Caption:=FloatToStr((a/100)/b) + ' Km/Jam' ;
  130.     End
  131.   Else If (Combobox1.ItemIndex=1) And
  132.     (ComboBox2.ItemIndex=1) then
  133.     Begin
  134.       LHasil.Caption:=FloatToStr((a/100)/(b/60)) + ' Km/Jam' ;
  135.     End
  136.   Else If (Combobox1.ItemIndex=1) And
  137.     (ComboBox2.ItemIndex=2) then
  138.     Begin
  139.       LHasil.Caption:=FloatToStr((a/100)/(b/3600)) + ' Km/Jam' ;
  140.     End;
  141. end;
  142.  
  143. procedure TFKJW.EJarakKeyPress(Sender: TObject; var Key: Char);
  144. begin
  145.   if not (key in['0'..'9',#8]) then key:= #0;
  146. end;
  147.  
  148. procedure TFKJW.EWaktuKeyPress(Sender: TObject; var Key: Char);
  149. begin
  150.   if not (key in['0'..'9',#8]) then key:= #0;
  151. end;
  152.  
  153. procedure TFKJW.Edit2KeyPress(Sender: TObject; var Key: Char);
  154. begin
  155.   if not (key in['0'..'9',#8]) then key:= #0;
  156. end;
  157.  
  158. procedure TFKJW.Edit3KeyPress(Sender: TObject; var Key: Char);
  159. begin
  160.   if not (key in['0'..'9',#8]) then key:= #0;
  161. end;
  162.  
  163. procedure TFKJW.Edit1KeyPress(Sender: TObject; var Key: Char);
  164. begin
  165.   if not (key in['0'..'9',#8]) then key:= #0;
  166. end;
  167.  
  168. procedure TFKJW.EKecepatanKeyPress(Sender: TObject; var Key: Char);
  169. begin
  170.   if not (key in['0'..'9',#8]) then key:= #0;
  171. end;
  172.  
  173. procedure TFKJW.Button3Click(Sender: TObject);
  174. begin
  175.   EJarak.Clear;
  176.   EWaktu.Clear;
  177.   LHasil.Caption:='0';
  178.   EJarak.SetFocus;
  179. end;
  180.  
  181. procedure TFKJW.FormShow(Sender: TObject);
  182. begin
  183.   PageControl1.ActivePageIndex:=0;
  184. end;
  185.  
  186. procedure TFKJW.Button7Click(Sender: TObject);
  187. Var a,b: Real;
  188. begin
  189.   a:=StrToFloat(EDit2.Text);
  190.   b:=StrToFloat(EDit3.Text);
  191.   If (ComboBox6.ItemIndex=0) And
  192.     (ComboBox5.ItemIndex=0) then
  193.     Begin
  194.       Label14.Caption:=FloatToStr(a*b) + ' Km' ;
  195.     End
  196.   Else If (Combobox6.ItemIndex=0) And
  197.     (ComboBox5.ItemIndex=1) then
  198.     Begin
  199.       Label14.Caption:=FloatToStr(a*(b/60)) + ' Km' ;
  200.     End
  201.   Else If (Combobox6.ItemIndex=0) And
  202.     (ComboBox5.ItemIndex=2) then
  203.     Begin
  204.       Label14.Caption:=FloatToStr(a*(b/3600)) + ' Km' ;
  205.     End
  206.   Else If (Combobox6.ItemIndex=1) And
  207.     (ComboBox5.ItemIndex=0) then
  208.     Begin
  209.       Label14.Caption:=FloatToStr((a/100)*b) + ' Km' ;
  210.     End
  211.   Else If (Combobox6.ItemIndex=1) And
  212.     (ComboBox5.ItemIndex=1) then
  213.     Begin
  214.       Label14.Caption:=FloatToStr((a/100)*(b/60)) + ' Km' ;
  215.     End
  216.   Else If (Combobox6.ItemIndex=1) And
  217.     (ComboBox5.ItemIndex=2) then
  218.     Begin
  219.       Label14.Caption:=FloatToStr((a/100)*(b/3600)) + ' Km' ;
  220.     End;
  221. end;
  222.  
  223. procedure TFKJW.Button4Click(Sender: TObject);
  224. Var a,b: Real;
  225. begin
  226.   a:=StrToFloat(Edit1.Text);
  227.   b:=StrToFloat(EKecepatan.Text);
  228.   If (Combobox4.ItemIndex=0) And
  229.     (ComboBox3.ItemIndex=0) then
  230.     Begin
  231.       Label9.Caption:=FloatToStr(a/b) + ' Jam' ;
  232.     End
  233.   Else If (Combobox4.ItemIndex=0) And
  234.     (ComboBox3.ItemIndex=1) then
  235.     Begin
  236.       Label9.Caption:=FloatToStr(a/(b/100)) + ' Jam' ;
  237.     End
  238.   Else If (Combobox4.ItemIndex=1) And
  239.     (ComboBox3.ItemIndex=0) then
  240.     Begin
  241.       Label9.Caption:=FloatToStr((a/100)/b) + ' Jam' ;
  242.     End
  243.   Else If (Combobox4.ItemIndex=1) And
  244.     (ComboBox3.ItemIndex=1) then
  245.     Begin
  246.       Label9.Caption:=FloatToStr((a/100)/(b/100)) + ' Jam' ;
  247.     End;
  248. end;
  249. {
  250. Created By Jean Riko Kurniawan Putra
  251. Programmer Delphi Di Delphi Anime Lover
  252. BLOG : djeansoftware.blogspot.com
  253. Fanpage : www.facebook.com/jean.software
  254. }
  255.  
  256. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement