Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
TUGAS BAHASA PEMEROGRAMAN
TUGAS 1.1 PROGRAM PERKALIAN DENGAN CMD HITUNG
Dengan text:
PADA CMD 1
Private Sub Command1_Click()
Text3.Text = Val(Text1) * Val(Text2)
End Sub
PADA CMD2
Private Sub Command2_Click()
Text1.SetFocus
Text1 = ""
Text2 = ""
Text3 = ""
End Sub
PADA CMD3
Private Sub Command3_Click()
End
End Sub
1.2 program perkalian dengan fungsi keypress Dan CMD
DENGAN TEXT:
PADA TEXT1
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
PADA TEXT2:
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.Text = Val(Text1) * Val(Text2)
End If
End Sub
PADA CMD 1
Private Sub Command1_Click()
Text3.Text = Val(Text1) * Val(Text2)
End Sub
PADA CMD2
Private Sub Command2_Click()
Text1.SetFocus
Text1 = ""
Text2 = ""
Text3 = ""
End Sub
PADA CMD3
Private Sub Command3_Click()
End
End Sub
1.3 program kalkolator mini dengan CMD
TERJADINYA DEBUG KARENA KOLOM TAK TERISI SEMUA
PERHATIKAN PERBEDAAN NYA.
DENGAN TEXT:
PADA CMD1
Private Sub Command1_Click()
Val (Text1) + Val(Text2)
Val (Text4) * Val(Text5)
Val (Text7) - Val(Text8)
Val (Text10): Val (Text11)
Text3.Text = Val(Text1) + Val(Text2)
Text4.SetFocus
Text6.Text = Val(Text4) * Val(Text5)
Text7.SetFocus
Text9.Text = Val(Text7) - Val(Text8)
Text10.SetFocus
Text12.Text = Val(Text10) / Val(Text11)
End Sub
PADA CMD 2
Private Sub Command2_Click()
Text1.SetFocus
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
Text11 = ""
Text12 = ""
End Sub
PADA CMD 3
Private Sub Command3_Click()
Text1.SetFocus
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
Text11 = ""
Text12 = ""
End Sub
PADA CMD4
Private Sub Command4_Click()
End
End Sub
1.4 program kalkulator mini dengan fungsi keypress
DENGAN TEXT:
PADA TEXT1
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
PADA TEXT2
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.Text = Val(Text1) + Val(Text2)
Text4.SetFocus
End If
End Sub
PADA TEXT4
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub
PADA TEXT5
Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text6.Text = Val(Text4) * Val(Text5)
Text7.SetFocus
End If
End Sub
PADA TEXT7
Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text8.SetFocus
End If
End Sub
PADA TEXT8
Private Sub Text8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text9.Text = Val(Text7) - Val(Text8)
Text10.SetFocus
End If
End Sub
PADA TEXT10
Private Sub Text10_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text11.SetFocus
End If
End Sub
PADA TEXT11
Private Sub Text11_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text12.Text = Val(Text10) / Val(Text11)
End If
End Sub
1.5 diskon dengan tombol HITUNG
DENGAN TEXT:
PADA CMD1
Private Sub Command1_Click()
End
End Sub
PADA CMD 2
Private Sub Command2_Click()
Text1.SetFocus
Text1 = ""
Text2 = ""
Text3 = ""
End Sub
PADA CMD3
Private Sub Command3_Click()
Text2.Text = Val(Text1) * 0.1
Text3.Text = Val(Text1) - Val(Text2)
End Sub
1.6 program diskon dengan keypress
DENGAN TEXT:
PADA TEXT1:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.Text = Val(Text1) * 0.1
Text3.Text = Val(Text1) - Val(Text2)
End If
End Sub
1.7 progam gaji pokok dengan CMD proses
DENGAN TEXT:
PADA CMD1
Private Sub Command1_Click()
Text4.Text = Val(Text1) + Val(Text2) - Val(Text3)
Text5.Text = Val(Text4) * 0.1
Text6.Text = Val(Text4) - Val(Text5)
End Sub
PADA CMD2
Private Sub Command2_Click()
Text1.SetFocus
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
End Sub
PADA CMD3
Private Sub Command3_Click()
End
End Sub
1.8 program aplikasi gaji pokok dengan keypress
DENGAN TEXT:
PADA TEXT1
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
PADA TEXT2
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
PADA TEXT3
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.Text = Val(Text1) + Val(Text2) - Val(Text3)
Text5.Text = Val(Text4) * 0.1
Text6.Text = Val(Text4) - Val(Text5)
End If
End Sub