The Sims 3 - New Real House

Pemrograman 5




Nama TextBox Hasil : hasil

Public Class Kasus4
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim x, y, w As Integer
        Dim a, z As String
        x = InputBox("Masukkan Bilai 1", "Entry Bilangan 1", "")
        y = InputBox("Masukkan Bilai 2", "Entry Bilangan 2", "")
        w = InputBox("Masukkan Bilai 3", "Entry Bilangan 3", "")
        a = InputBox("Masukkan Operator 1", "Entry operator 1", "")
        z = InputBox("Masukkan Operator 2", "Entry operator 2", "")

        If a = "+" And z = "+" Then
            hasil.Text = Val(x) + Val(y) + Val(w)
        ElseIf a = "+" And z = "-" Then
            hasil.Text = Val(x) + Val(y) - Val(w)
        ElseIf a = "+" And z = "x" Then
            hasil.Text = Val(x) + Val(y) * Val(w)
        ElseIf a = "+" And z = "/" Then
            hasil.Text = Val(x) + Val(y) / Val(w)
        ElseIf a = "+" And z = "mod" Then
            hasil.Text = Val(x) + Val(y) Mod Val(w)
        ElseIf a = "-" And z = "-" Then
            hasil.Text = Val(x) - Val(y) - Val(w)
        ElseIf a = "-" And z = "+" Then
            hasil.Text = Val(x) - Val(y) + Val(w)
        ElseIf a = "-" And z = "x" Then
            hasil.Text = Val(x) - Val(y) * Val(w)
        ElseIf a = "-" And z = "/" Then
            hasil.Text = Val(x) - Val(y) / Val(w)
        ElseIf a = "-" And z = "mod" Then
            hasil.Text = Val(x) - Val(y) Mod Val(w)
        ElseIf a = "x" And z = "x" Then
            hasil.Text = Val(x) * Val(y) * Val(w)
        ElseIf a = "x" And z = "/" Then
            hasil.Text = Val(x) * Val(y) / Val(w)
        ElseIf a = "x" And z = "+" Then
            hasil.Text = Val(x) * Val(y) + Val(w)
        ElseIf a = "x" And z = "-" Then
            hasil.Text = Val(x) * Val(y) - Val(w)
        ElseIf a = "x" And z = "mod" Then
            hasil.Text = Val(x) * Val(y) Mod Val(w)
        ElseIf a = "/" And z = "/" Then
            hasil.Text = Val(x) / Val(y) / Val(w)
        ElseIf a = "/" And z = "x" Then
            hasil.Text = Val(x) / Val(y) * Val(w)
        ElseIf a = "/" And z = "+" Then
            hasil.Text = Val(x) / Val(y) + Val(w)
        ElseIf a = "/" And z = "-" Then
            hasil.Text = Val(x) / Val(y) - Val(w)
        ElseIf a = "/" And z = "mod" Then
            hasil.Text = Val(x) / Val(y) Mod Val(w)
        ElseIf a = "mod" And z = "mod" Then
            hasil.Text = Val(x) Mod Val(y) Mod Val(w)
        ElseIf a = "mod" And z = "x" Then
            hasil.Text = Val(x) Mod Val(y) * Val(w)
        ElseIf a = "mod" And z = "/" Then
            hasil.Text = Val(x) Mod Val(y) / Val(w)
        ElseIf a = "mod" And z = "+" Then
            hasil.Text = Val(x) Mod Val(y) + Val(w)
        ElseIf a = "mod" And z = "-" Then
            hasil.Text = Val(x) Mod Val(y) - Val(w)
        Else
            hasil.Text = 0
        End If
    End Sub
End Class

Komentar