Laporan conditional statements

522 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
522
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Laporan conditional statements

  1. 1. LAPORAN PRAKTIKUM PEMROGRAMAN KOMPUTER DAN KOMPUTASI NUMERIK CONDITIONAL STATEMENTS DI SUSUN OLEH : NAMA : DWI LESTARI NIM : 021100295 PRODI : ELEKTRONIKA INSTRUMENTASI SEMETER : 3 ASISTEN : BUDI SUHENDRO, SST SEKOLAH TINGGI TEKNOLOGI NUKLIR BADAN TENAGA NUKLIR NASIONAL YOGYAKARTA 2013
  2. 2. CONDITIONAL STATMENTS Tujuan : untuk memahami perintah conditional statements Langkah Kerja : 1. Masuk ke program delphi. 2. Klik pada halaman form 1. 3. Buat form seperti gambar berikut.
  3. 3. 4. Pada “golongan” di buat dengan cara mengeklik ikon combo box, sedangkan “masa kerja” dan “jumlah anak” di buat dengan menggunakan ikon radio group, lalu buat pilihan menggunakan radio button. 5. Pada “golongan” beri pilihan “A” dan “B” dengan cara mengeklik ikon items pada properties. 6. Setelah itu masukkan perintah-perintah yang sesuai dengan keinginan pada halaman unit1, isi masukan perintah seperti pada halaman lampiran. 7. Setelah semua di masukkan jalankan program dengan mengeklik tombol f9 atau run pada ikon delphi. 8. Hasil yang akan tampak saat program di jalankan :
  4. 4. KESIMPULAN 1. Com box digunakan untuk memberi pilihan sub menu pada kolom masa kerja dan jumlah anak. 2. Pada conditional statement dapat menggunakan perintah IF.. THEN...ELSE.. sehingga memudahkan penginutan perintah.
  5. 5. LAMPIRAN Hasil Masukan Pada Unit1 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Label1: TLabel; RadioGroup1: TRadioGroup; RadioButton1: TRadioButton; RadioButton2: TRadioButton; ComboBox1: TComboBox; RadioGroup2: TRadioGroup; RadioButton3: TRadioButton; RadioButton4: TRadioButton; RadioButton5: TRadioButton; Label2: TLabel; Label3: TLabel; Edit1: TEdit; Edit2: TEdit; Label4: TLabel; Edit3: TEdit; Label5: TLabel; Edit4: TEdit; Label6: TLabel; Label7: TLabel; Edit5: TEdit; Edit6: TEdit; Button1: TButton; Label8: TLabel; Edit7: TEdit; RadioButton6: TRadioButton; Button2: TButton; Button3: TButton; Button4: TButton; Label9: TLabel; procedure ComboBox1Change(Sender: TObject); procedure RadioButton2Click(Sender: TObject); procedure RadioButton1Click(Sender: TObject); procedure RadioButton3Click(Sender: TObject); procedure RadioButton4Click(Sender: TObject);
  6. 6. procedure RadioButton5Click(Sender: TObject); procedure RadioButton6Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); private { Private declarations } public { Public declarations } gajipokok,insentif,tunjangan,gajitotal:real; end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.ComboBox1Change(Sender: TObject); begin if combobox1.text='A' then begin edit1.Text:='1000000' end else if combobox1.text='B' then edit1.Text:='2000000' end; procedure TForm1.RadioButton2Click(Sender: TObject); begin if radiobutton2.Checked=true then edit2.Text:='500000' end; procedure TForm1.RadioButton1Click(Sender: TObject); begin if radiobutton1.Checked=true then edit2.Text:='200000' end; procedure TForm1.RadioButton3Click(Sender: TObject); begin if radiobutton3.Checked=true then edit3.Text:='0'
  7. 7. end; procedure TForm1.RadioButton4Click(Sender: TObject); begin if radiobutton4.Checked=true then edit3.Text:='200000' end; procedure TForm1.RadioButton5Click(Sender: TObject); begin if radiobutton5.Checked=true then edit3.Text:='400000' end; procedure TForm1.RadioButton6Click(Sender: TObject); begin if radiobutton6.Checked=true then edit3.Text:='500000' end; procedure TForm1.Button1Click(Sender: TObject); var gajipokok,insentif,tunjangan,gajitotal:real; begin gajipokok:=strtofloat(edit1.Text); insentif:=strtofloat(edit2.text); tunjangan:=strtofloat(edit3.text); gajitotal:=gajipokok+insentif+tunjangan; form1.Edit4.Text:=floattostr(gajitotal); form1.show; end; procedure TForm1.Button2Click(Sender: TObject); var gajitotal,pajak:real; begin pajak:=0; gajitotal:=strtofloat(edit4.Text) ; if gajitotal >= 2750000 then begin pajak:=gajitotal*0.1; edit5.Text:=floattostr(pajak); edit6.Text:=floattostr(gajitotal-pajak); end end; procedure TForm1.Button3Click(Sender: TObject); var gajitotal,pajak:real; begin
  8. 8. pajak:=0; gajitotal:=strtofloat(edit4.Text) ; if gajitotal >= 2250000 then begin pajak:=gajitotal*0.05; edit5.Text:=floattostr(pajak); edit6.Text:=floattostr(gajitotal-pajak); end end; procedure TForm1.Button4Click(Sender: TObject); var gajitotal,pajak:real; begin pajak:=0; gajitotal:=strtofloat(edit4.Text) ; if gajitotal < 2250000 then begin pajak:=gajitotal*0.0; edit5.Text:=floattostr(pajak); edit6.Text:=floattostr(gajitotal-pajak); end; end; end.

×