Monday, January 21, 2008

Zodiak

unit Zodiak;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Borland.Vcl.ComCtrls, Borland.Vcl.StdCtrls, System.ComponentModel;
type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Button1: TButton; Button2: TButton; Button3: TButton; DateTimePicker1: TDateTimePicker; Memo1: TMemo; procedure DateTimePicker1Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.nfm}
procedure TForm1.DateTimePicker1Click(Sender: TObject);const star:array[1..12]of record nama:string[10]; tgl1,bln1,tgl2,bln2:integer;end=((nama:'Aries';tgl1:21;bln1:3;tgl2:19;bln2:4),(nama:'Taurus';tgl1:20;bln1:4;tgl2:20;bln2:5),(nama:'Gemini';tgl1:21;bln1:5;tgl2:20;bln2:6),(nama:'Cancer';tgl1:21;bln1:6;tgl1:22;bln2:7),(nama:'Leo';tgl1:23;bln1:7;tgl2:22;bln2:8),(nama:'Virgo';tgl1:23;bln1:8;tgl2:22;bln2:9),(nama:'Libra';tgl1:23;bln1:9;tgl2:22;bln2:10),(nama:'Scorpio';tgl1:23;bln1:10;tgl2:21;bln2:11),(nama:'Sagitarius';tgl1:22;bln1:11;tgl1:21;bln2:12),(nama:'Capricorn';tgl1:22;bln1:12;tgl2:19;bln2:1),(nama:'Aquarius';tgl1:20;bln1:1;tgl2:18;bln2:2),(nama:'Pisces';tgl1:19;bln1:2;tgl2:20;bln2:3));
var indeks,kdhari:integer; tahun,bulan,tanggal:word;beginkdhari:=dayofweek(Datetimepicker1.DateTime);case kdhari of 1:label5.Caption:='Minggu'; 2:label5.Caption:='Senin'; 3:label5.caption:='Selasa'; 4:label5.caption:='Rabu'; 5:label5.Caption:='Kamis'; 6:label5.caption:='Jumat'; 7:label5.caption:='Sabtu';end; decodedate(DateTimePicker1.DateTime,Tahun,Bulan,Tanggal); for indeks:=1 to 12 do if((tanggal>=star[indeks].tgl1)and (bulan=star[indeks].bln1)or (tanggal<=star[indeks].tgl2)and (bulan=star[indeks].bln2))thenbegin label6.caption:=''+star[indeks].nama; break;end;end;
procedure TForm1.Button1Click(Sender: TObject);beginif label6.Caption='Gemini'thenmemo1.text:='Lagi Kangen Nie?'elseif label6.Caption='Cancer' thenmemo1.text:='Gak Tau Mu Ngapain!!!'elseif label6.Caption='Aquarius' thenmemo1.text:='Pengen Putus Aja?'elseif label6.Caption='Aries' thenmemo1.text:='Masih Banyak Ko Cewe Yang OK'elseif label6.Caption='Taurus' thenmemo1.text:='Emangnya Lu Aja Yang Bisa Bkin Gw Happy...?'elseif label6.Caption='Virgo' thenmemo1.text:='Emang dia tuh lebih dari apapun'elseif label6.Caption='Capricorn' thenmemo1.text:='Pengennya Gtuan Mulu 'elseif label6.Caption='Sagitarius' thenmemo1.text:='Pengen week end yang jauh jauh 'elseif label6.Caption='Leo' thenmemo1.text:='Tahan Dunk Marah-marahnya kan Lg bulan Puasa?'elseif label6.Caption='Libra' thenmemo1.text:='Pengen punya cewe buanyak akh..???'elseif label6.Caption='Scorpio' thenmemo1.text:='wah cepet minta maaf dunk ama dia kasian lho....'elseif label6.Caption='Pisces' thenmemo1.text:='Aduh lg BT brat....'
end;
procedure TForm1.Button2Click(Sender: TObject);beginif label6.Caption='Gemini' thenmemo1.Text:='Lagi Kanker(Kantong Kering Gituu...lochhh)'elseif label6.Caption='Cencer' thenmemo1.Text:='Ngirit dunk Ya Ya..'elseif label6.Caption='Aquarius' thenmemo1.Text:='lg banyak uang nie ye...!!!'elseif label6.Caption='Aries' thenmemo1.Text:='Bagi bagiin tuh uang nanti gak maslahat?'elseif label6.Caption='Taurus' thenmemo1.Text:='kalo lg bokek jgn suka maksain deh..'elseif label6.Caption='Virgo' thenmemo1.Text:='Bakalan dapet rejeki minggu ini BOSS'elseif label6.Caption='Capricorn' thenmemo1.Text:='Jgn terlalu ngabisin uang ama pulsa'elseif label6.Caption='Sagitarius' thenmemo1.Text:='Abis ama cewe lu deh kayanya bulan ini?'elseif label6.Caption='Leo' thenmemo1.Text:='jiwa besar akan mempengaruhi tuh...'elseif label6.Caption='Libra' thenmemo1.Text:='awas disengat dari belakang?'elseif label6.Caption='Scorpio' thenmemo1.Text:='salah sendiri beli2 yang gak jelas'elseif label6.Caption='Pisces' thenmemo1.Text:='duh yang lg adem ayem...'
end;
procedure TForm1.Button3Click(Sender: TObject);beginif label6.Caption='Gemini' thenmemo1.Text:='Rabu'elseif label6.Caption='Cancer' thenmemo1.Text:='Kamis'elseif label6.Caption='Aquarius' thenmemo1.Text:='Sabtu'elseif label6.Caption='Aries' thenmemo1.Text:='Malam Minggu'elseif label6.Caption='Taurus' thenmemo1.Text:='Malam Kliwon'elseif label6.Caption='Virgo' thenmemo1.Text:='Minggu'elseif label6.Caption='Capricorn' thenmemo1.Text:='Senin,Jumat'elseif label6.Caption='Sagitarius' thenmemo1.Text:='Jumat'elseif label6.Caption='Leo' thenmemo1.Text:='Selasa'elseif label6.Caption='Libra' thenmemo1.Text:='Senin,Minggu'elseif label6.Caption='Scorpio' thenmemo1.Text:='Rabu'elseif label6.Caption='Pisces' thenmemo1.Text:='Kamis'
end;
end.

Friday, November 2, 2007

Train Ticketing

unit Train;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Borland.Vcl.StdCtrls, System.ComponentModel;
type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; GroupBox1: TGroupBox; Label10: TLabel; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; Label16: TLabel; Label17: TLabel; Label18: TLabel; ComboBox1: TComboBox; ComboBox2: TComboBox; ComboBox3: TComboBox; ComboBox4: TComboBox; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; Label8: TLabel; Label19: TLabel; procedure Edit2Change(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.nfm}
procedure TForm1.Edit2Change(Sender: TObject);beginlabel19.Caption:=datetimetostr(now);end;
procedure TForm1.Button1Click(Sender: TObject);beginif combobox1.Itemindex=0 thenif combobox2.itemindex=0 thenif edit1.text='1' thenedit2.text:='20000'elseif combobox1.Itemindex=0 thenif combobox2.itemindex=0 thenif edit1.text='2' thenedit2.text:='40000';beginif combobox1.Itemindex=0 thenif combobox2.itemindex=1 thenif edit1.text='1' thenedit2.text:='30000'elseif combobox1.Itemindex=0 thenif combobox2.itemindex=1 thenif edit1.text='2' thenedit2.text:='60000';beginif combobox1.Itemindex=0 thenif combobox2.itemindex=2 thenif edit1.text='1' thenedit2.text:='40000'elseif combobox1.Itemindex=0 thenif combobox2.itemindex=2 thenif edit1.text='2' thenedit2.text:='80000';beginif combobox1.Itemindex=1 thenif combobox2.itemindex=0 thenif edit1.text='1' thenedit2.text:='10000'elseif combobox1.Itemindex=1 thenif combobox2.itemindex=0 thenif edit1.text='2' thenedit2.text:='20000';beginif combobox1.Itemindex=1 thenif combobox2.itemindex=1 thenif edit1.text='1' thenedit2.text:='15000'elseif combobox1.Itemindex=1 thenif combobox2.itemindex=1 thenif edit1.text='2' thenedit2.text:='30000';beginif combobox1.Itemindex=1 thenif combobox2.itemindex=2 thenif edit1.text='1' thenedit2.text:='25000'elseif combobox1.ItemIndex=1 thenif combobox2.ItemIndex=2 thenif edit1.text='2' thenedit2.Text:='50000';end;end;end;end;end;end;

procedure TForm1.Button2Click(Sender: TObject);begincombobox1.ClearSelection;combobox2.clearselection;combobox3.ClearSelection;combobox4.ClearSelection;edit1.clear;edit2.clear;end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);beginif not(key in['1'..'2',#2])thenkey:=#0;end;
end.

Thursday, October 18, 2007