Sunday, October 30, 2011

Nested IF Quis ( VB )


Terms of problem : 


kode montir kode motor biaya

WWN                   SZK 50000
(Wewen)                HND       55000
                            YMH 60000

BDI                        SZK       60000
(Budi) HND 65000
                            YMH 70000



When the form is active then the textbox code mechanic, motor code, name of the mechanic, service prices, oil prices, total prices and money back in an inactive state.

At the click "Hitung" will pay out the total value.

When the input of money paid and the press enter then the money returned.

At the click "Input Lagi" then all net textbox.

To make a timer using two labels and a timer in the properties
Change the name of the label 1 = jam
And label 2 = tanggal
Click 2x on a timer and enter the listing:

jam.caption = time
Tanggal.caption = format (date, "dddd, d mmmm, yyyy")


on the properties of the timer, change interval = 100


this is the listing :




Private Sub cck1_Click()
If cck1 = 1 And cck2 = 1 Then
    txtservis = 80000
ElseIf cck1 = 1 Then
    txtservis = 30000
ElseIf cck2 = 1 Then
    txtservis = 50000
Else
    txtservis = 0
End If
End Sub

Private Sub cck2_Click()
If cck1 = 1 And cck2 = 1 Then
    txtservis = 80000
ElseIf cck1 = 1 Then
    txtservis = 30000
ElseIf cck2 = 1 Then
    txtservis = 50000
Else
    txtservis = 0
End If
End Sub

Private Sub Ckomon_Click()
If Ckomon.Text = "WWN" Then
    txtnamon = "Wewen"
Else
    txtnamon = "Budi"
End If
End Sub


Private Sub Ckotor_Click()
If Ckotor.Text = "SZK" Then
    txtjenis = "Suzuki"
    If Ckomon.Text = "WWN" Then
        txtbiaya = 50000
    Else
        txtbiaya = 60000
    End If
ElseIf Ckotor.Text = "HND" Then
    txtjenis = "Honda"
    If Ckomon.Text = "WWN" Then
        txtbiaya = 55000
    Else
        txtbiaya = 65000
    End If
Else
    txtjenis = "Yamaha"
    If Ckomon.Text = "WWN" Then
        txtbiaya = 60000
    Else
        txtbiaya = 70000
    End If
End If
End Sub

Private Sub Cmdhitung_Click()
txttotbay = Val(txtbiaya) + Val(txtservis) + Val(txtoli)
txtubay.SetFocus
End Sub

Private Sub cmdinput_Click()
txtnama = ""
Ckomon = "-PiliH-"
Ckotor = "-PiliH-"
txtnamon = ""
txtjenis = ""
txtbiaya = ""
cck1 = False
cck2 = False
txtservis = ""
optganti = False
opttidak = False
txtoli = ""
txttotbay = ""
txtubay = ""
txtukem = ""
End Sub

Private Sub cmdkeluar_Click()
If MsgBox("Yakin lo mau Keluar ??", 36, "WArning") = vbYes Then
End
End If
End Sub

Private Sub Form_Load()
txtnamon.Enabled = False
txtjenis.Enabled = False
txtbiaya.Enabled = False
txtservis.Enabled = False
txtoli.Enabled = False
txttotbay.Enabled = False
txtukem.Enabled = False
End Sub

Private Sub optganti_Click()
txtoli = 30000
Cmdhitung.SetFocus
End Sub

Private Sub opttidak_Click()
txtoli = 0
Cmdhitung.SetFocus
End Sub

Private Sub Timer1_Timer()
jam.Caption = Time
tanggal.Caption = Format(Date, "dddd, d ,mmmm, yyyy")
End Sub


Private Sub txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    txtukem = Val(txtubay) - Val(txttotbay)
    cmdinput.SetFocus
End If
End Sub


Enjoy it... ^_^
If anyone does not understand please ask and leave a comment ..
and do not forget to follow our blog ..^_^

ReadMore...

Saturday, October 29, 2011

Toko Swalayan Program

Terms of Problem:

1. The others in the ordinary input.
2. when the amount bought in the press enter the total price paid will appear.
3. current at the input of money to pay the money back will appear.
4. when the program runs, the display of textbox in an inactive state, and after the click data input and then active again.

Use the textbox tool, command buttons and labels


This is the listing Program :







Private Sub cmdinput_Click()
txtnofak.Enabled = True
txtnofak.Text = ""
txtkobar.Enabled = True
txtkobar.Text = ""
txtnabar.Enabled = True
txtnabar.Text = ""
txtharga.Enabled = True
txtharga.Text = ""
txtjumbel.Enabled = True
txtjumbel.Text = ""
txttotbay.Enabled = False
txttotbay.Text = ""
txtubay.Enabled = True
txtubay.Text = ""
txtukem.Enabled = False
txtukem.Text = ""
txtnofak.SetFocus
End Sub

Private Sub cmdkeluar_Click()
If MsgBox("Yakin lw mau keluar ???", 36, "Warning") = vbYes Then
End
End If
End Sub

Private Sub Form_Activate()
txtnofak.Enabled = False
txtkobar.Enabled = False
txtnabar.Enabled = False
txtharga.Enabled = False
txtjumbel.Enabled = False
txttotbay.Enabled = False
txtubay.Enabled = False
txtukem.Enabled = False
cmdinput.SetFocus
End Sub


Private Sub txtjumbel_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    txttotbay = Val(txtharga) * Val(txtjumbel)
    txtubay.SetFocus
End If
End Sub

Private Sub txtubay_Change()
txtukem.Text = Val(txtubay) - Val(txttotbay)
End Sub



Enjoy it... ^_^
If anyone does not understand please ask and leave a comment ..
and do not forget to follow our blog ..^_^


ReadMore...

Friday, October 28, 2011

Exercise "IF function"

Create an output like this...
(Sorry if it looks a bit messy, but the results and listing program remains true, do not worry .. ^ _ ^)

This is the Listing Program :

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

main()
{

char nama[20],pend[3];
int jam,gol;
float hontap=300000,tunjab,tunpend,honlem,hontem;

cout<<"Program Hitung Honor Karyawan Kontrak"<<endl;
cout<<"PT.Dingin Damai"<<endl<<endl;
cout<<"Nama Karyawan : ";gets(nama);
cout<<"Golongan : ";cin>>gol;
cout<<"Pendidikan <SMU|D3|S1> : ";cin>>pend;
cout<<"Jumlah Jam Kerja : ";cin>>jam;


if(gol==1)
{
   tunjab=0.05*hontap;
   if(strcmp(pend,"SMU")==0)
   tunpend=0.025*hontap;
   else if(strcmp(pend,"D3")==0)
   tunpend=0.05*hontap;
   else if(strcmp(pend,"S1")==0)
   tunpend=0.075*hontap;
   else
   tunpend=0;
   }
else if(gol==2)
{
   tunjab=0.1*hontap;
   if(strcmp(pend,"SMU")==0)
   tunpend=0.025*hontap;
   else if(strcmp(pend,"D3")==0)
   tunpend=0.05*hontap;
   else if(strcmp(pend,"S1")==0)
   tunpend=0.075*hontap;
   else
   tunpend=0;
   }
else if(gol==3)
{
   tunjab=0.15*hontap;
   if(strcmp(pend,"SMU")==0)
   tunpend=0.025*hontap;
   else if(strcmp(pend,"D3")==0)
   tunpend=0.05*hontap;
   else if(strcmp(pend,"S1")==0)
   tunpend=0.075*hontap;
   else
   tunpend=0;
   }
else
tunjab=0;

if(jam>8)
honlem=(jam-8)*2500;
else
honlem=0;

hontem = hontap + tunjab + tunpend + honlem;

cout<<"Karyawan Yang Bernama : "<<nama<<endl;
cout<<"Honor yang DiTerima : "<<endl<<endl;
cout<<"Honor Tetap : Rp. "<<hontap<<endl;
cout<<"Tunjangan Jabatan : Rp. "<<tunjab<<endl;
cout<<"Tunjangan Pendidikan : Rp. "<<tunpend<<endl;
cout<<"Honor Lembur : Rp. "<<honlem<<endl;
cout<<"                     -------------------------- +"<<endl;
cout<<"Honor Yang Di Terima   : Rp. "<<hontap<<endl<<endl;

getch();
}

Enjoy it... ^_^
If anyone does not understand please ask and leave a comment ..
and do not forget to follow our blog ..^_^




ReadMore...

Thursday, October 27, 2011

Arithmatic Operator Program


Create an output like this..

This is the listing Program : 

#include<stdio.h>
#include<conio.h>
#include<iostream.h>



main()
{

float a,b,v,w,y,z;

cout<<"Masukkan Nilai A = ";cin>>a;
cout<<"Masukkan Nilai B = ";cin>>b;
cout<<endl<<endl;

v=a*b;
w=a/b;
y=a+b;
z=a-b;

cout<<"Hasil Dari Perkalian  a*b = "<<v<<endl;
cout<<"Hasil Dari Pembagian  a/b = "<<w<<endl;
cout<<"Hasil Dari Penjumlahan    a+b = "<<y<<endl;
cout<<"Hasil Dari Pengurangan  a-b = "<<z<<endl;


getch();
}


Enjoy it...
if any one does not understand please ask and leave a comment and  follow our blogs ...^_^
ReadMore...

Relation Operator Program ( C++ )

Create an output like this


Listing Program :

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

main()
{
float z,y,x,w,v,u,a,b;

cout<<"Program Operator Relasi"<<endl<<endl;
cout<<"Masukkan Nilai A = ";cin>>a;
cout<<"Masukkan Nilai B = ";cin>>b;
cout<<endl<<endl;

u=a==b;
v=a!=b;
w=a>b;
x=a<b;
y=a>=b;
z=a<=b;

cout<<"Program Operator Relasi"<<endl<<endl;
cout<<"Hasil Dari "<<a<<" == "<<b<<" = "<<u<<endl;
cout<<"Hasil Dari "<<a<<" != "<<b<<" = "<<v<<endl;
cout<<"Hasil Dari "<<a<<"  > "<<b<<" = "<<w<<endl;
cout<<"Hasil Dari "<<a<<"  < "<<b<<" = "<<x<<endl;
cout<<"Hasil Dari "<<a<<" >= "<<b<<" = "<<y<<endl;
cout<<"Hasil Dari "<<a<<" <= "<<b<<" = "<<z<<endl;

getch();
}


enjoy it .. ^_^

if any one does not understand please ask and leave a comment ..^_^

ReadMore...

Color Recognition ( Pengenalan Warna )





Terms of Problem:

1. At the time the form is run then display a black background with the color settings for thetextbox & HFFFF80
2. Menu option is used to modify the shape and color of text in the textbox 2. Menu optionis used to modify the shape and color of text in the textbox
3. clean button is used to clean the display 3. clean button is used to clean the display
4. exit button is used to exit the program without the messagebox 4. exit button is used toexit the program without the messagebox

Ketentuan Soal :

1. Pada saat form dijalankan tampilan background berwarna hitam kemudian untuk textbox dengan pengaturan warna &HFFFF80 1. At the time the form is run then display a black background with the color settings for the textbox & HFFFF80
2. Menu pilihan digunakan untuk memodifikasi bentuk dan warna tulisan di dalam textbox 2. Menu option is used to modify the shape and color of text in the textbox
3. tombol bersih digunakan untuk membersihkan tampilan 3. clean button is used to clean the display
4. tombol keluar digunakan untuk keluar program tanpa messagebox 4. exit button is used to exit the program without the messagebox



Listing Program :

Private Sub Cmdbersih_Click()
Txthasil = ""
Txthasil.SetFocus
End Sub

Private Sub cmdkeluar_Click()
End
End Sub

Private Sub Form_Load()
Form1.BackColor = vbBlack
Txthasil.BackColor = &HFFFF80
End Sub

Private Sub Optblue_Click()
Txthasil.ForeColor = vbBlue
End Sub

Private Sub Optbold_Click()
Txthasil.FontBold = True
Txthasil.FontUnderline = False
Txthasil.FontItalic = False
End Sub

Private Sub Optitalic_Click()
Txthasil.FontItalic = True
Txthasil.FontBold = False
Txthasil.FontUnderline = False
End Sub

Private Sub Optred_Click()
Txthasil.ForeColor = vbRed
End Sub

Private Sub Optunder_Click()
Txthasil.FontUnderline = True
Txthasil.FontBold = False
Txthasil.FontItalic = False
End Sub

Private Sub Optyellow_Click()
Txthasil.ForeColor = vbYellow
End Sub


Thanks..enjoy it..ganbatte.. ^_^
ReadMore...

Tuesday, October 25, 2011

Constanta and Variable

This is the first desain,if you click Constanta and then you will see numbers like the picture below
if you click variable,then the input box will appear as below 
input value what you want
And the last if you press enter or ok then the display will be as below..

Ok,now..This is the listing..:


Public x As Single
Public y As Single
Public z As Single
Sub konstanta()
x = 10
y = 15
z = x * y
Print "X dalam nilai1 : ", x
Print "Y dalam nilai1 : ", y
Print "Z dalam nilai1 : ", z
Print ""
End Sub

Sub nilai2()
Dim a As Integer
Dim b As Integer
Dim c As Integer

a = InputBox("Ketikkan Nilai1 :", "Input")
b = InputBox("Ketikkan nilai2 :", "input")
c = a * b
Print "A dalam nilai2 :", a
Print "B dalam nilai2 :", b
Print "C dalam nilai2 :", c
Print ""
End Sub
Private Sub cmdkonstanta_click()
konstanta
End Sub
Private Sub cmdvariabel_click()
nilai2
End Sub
Private Sub cmdkeluar_click()
Unload Me
End Sub



__if there are who do not understand please ask to leave a comment (jika ada yg tidak dimengerti silahkan bertanya dengan meninggalkan komentar) __
^Anzen na gakushuu^^Ganbatte^
ReadMore...

Monday, October 24, 2011

Operator Relasi ( C++ )

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

main()
{

float z,y,x,w,v,u,a,b;

cout<<"Program Operator Relasi"<<endl<<endl;
cout<<"Masukkan Nilai A = ";cin>>a;
cout<<"Masukkan Nilai B = ";cin>>b;
cout<<endl<<endl;

u=a==b;
v=a!=b;
w=a>b;
x=a<b;
y=a>=b;
z=a<=b;

cout<<"Program Operator Relasi"<<endl<<endl;
cout<<"Hasil Dari "<<a<<" == "<<b<<" = "<<u<<endl;
cout<<"Hasil Dari "<<a<<" != "<<b<<" = "<<v<<endl;
cout<<"Hasil Dari "<<a<<"  > "<<b<<" = "<<w<<endl;
cout<<"Hasil Dari "<<a<<"  < "<<b<<" = "<<x<<endl;
cout<<"Hasil Dari "<<a<<" >= "<<b<<" = "<<y<<endl;
cout<<"Hasil Dari "<<a<<" <= "<<b<<" = "<<z<<endl;

getch();
}


Output :

ReadMore...

Sunday, October 23, 2011

Introduction Form



Listing Program :

Private Sub cmdkeluar_Click()
p = MsgBox("Anda yakin akan keluar", vbQuestion + vbOKCancel, "Informasi")
If p = vbOK Then
End
End If
End Sub

Private Sub cmdlihat_Click()
MsgBox "NIM anda adalah " + Txtnim.Text
MsgBox "Nama anda adalah " + Txtnama.Text

End Sub

ReadMore...

Decimal,Octal and Hexadecimal ( C++ )

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>

main ()
{
int nilai;

cout<<"Nilai = ";cin>>nilai;
cout<<endl;
cout<<"Nilai ke Octal = "<<oct<<nilai<<endl;
cout<<"Nilai ke Hexadesimal = "<<hex<<nilai<<endl;
cout<<"Nilai ke Desimal = "<<dec<<nilai<<endl;

getch();
}

ReadMore...