0% found this document useful (0 votes)
74 views2 pages

Pemograman Untuk Uts

This document contains code for a program that calculates prices and discounts. It defines classes and modules to handle radio button and combo box selections to determine a base price, calculate totals, and apply discounts of 10%, 20%, or 50% depending on the user's selections. The program uses if/else statements and select cases to check selections and calculate the appropriate prices and discounts.

Uploaded by

Dinil Haq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views2 pages

Pemograman Untuk Uts

This document contains code for a program that calculates prices and discounts. It defines classes and modules to handle radio button and combo box selections to determine a base price, calculate totals, and apply discounts of 10%, 20%, or 50% depending on the user's selections. The program uses if/else statements and select cases to check selections and calculate the appropriate prices and discounts.

Uploaded by

Dinil Haq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Public Class BisFungsi

If RadioButton2.Checked = True Then


Private Sub RadioButton1_CheckedChanged(ByVal sender As If RadioButton3.Checked = True Then
System.Object, ByVal e As System.EventArgs) Handles Select Case ComboBox1.SelectedIndex
RadioButton1.CheckedChanged Case 0 : harga = 10000
ComboBox1.Items.Clear() Case 1 : harga = 30000
ComboBox1.Items.Add("Ploso") Case 2 : harga = 50000
ComboBox1.Items.Add("Babat") End Select
ComboBox1.Items.Add("Tuban") Else
End Sub Select Case ComboBox1.SelectedIndex
Case 0 : harga = 20000
Private Sub RadioButton2_CheckedChanged(ByVal sender As Case 1 : harga = 50000
System.Object, ByVal e As System.EventArgs) Handles Case 2 : harga = 70000
RadioButton2.CheckedChanged End Select
ComboBox1.Items.Clear() End If
ComboBox1.Items.Add("Kandangan") If RadioButton5.Checked = True Then
ComboBox1.Items.Add("Pujon") total = harga * Val(TextBox1.Text)
ComboBox1.Items.Add("Malang") TextBox2.Text = Str(SepuluhPersen(Val(total)))
End Sub ElseIf RadioButton6.Checked = True Then
Private Sub Cmdhitung_Click(ByVal sender As System.Object, ByVal total = harga * Val(TextBox1.Text)
e As System.EventArgs) Handles Cmdhitung.Click TextBox2.Text = Str(DuaPuluhPersen(Val(total)))
Dim harga, total As Double Else
If RadioButton1.Checked = True Then total = harga * Val(TextBox1.Text)
If RadioButton3.Checked = True Then TextBox2.Text = Str(LimaPuluhPersen(Val(total)))
Select Case ComboBox1.SelectedIndex End If
Case 0 : harga = 5000 End If
Case 1 : harga = 10000
Case 2 : harga = 30000 End Sub
End Select Private Sub Cmdkeluar_Click(ByVal sender As System.Object, ByVal
Else e As System.EventArgs) Handles Cmdkeluar.Click
Select Case ComboBox1.SelectedIndex End
Case 0 : harga = 10000 End Sub
Case 1 : harga = 20000
Case 2 : harga = 40000 End Class
End Select
End If Module Module_fungsi
If RadioButton5.Checked = True Then Function SepuluhPersen(ByVal Persen As Single) As Single
total = harga * Val(TextBox1.Text) SepuluhPersen = (Persen - Persen / 10)
TextBox2.Text = Str(SepuluhPersen(Val(total))) End Function
ElseIf RadioButton6.Checked = True Then Function DuaPuluhPersen(ByVal Persen As Single) As Single
total = harga * Val(TextBox1.Text) DuaPuluhPersen = (Persen - Persen / 5)
TextBox2.Text = Str(DuaPuluhPersen(Val(total))) End Function
Else Function LimaPuluhPersen(ByVal Persen As Single) As Single
total = harga * Val(TextBox1.Text) LimaPuluhPersen = (Persen - Persen / 2)
TextBox2.Text = Str(LimaPuluhPersen(Val(total))) End Function
End If End Module
End If
g

You might also like