The document describes a simple calculator program interface and code. It includes code to set up the interface with input boxes for two numbers and an output box for the result. It also includes code for radio buttons to select the operator of addition, subtraction, multiplication, or division and a button to calculate the result. The calculate button code performs the math operation based on the selected operator and displays the result. There is also a "Try Again" button to clear the fields.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online from Scribd
The document describes a simple calculator program interface and code. It includes code to set up the interface with input boxes for two numbers and an output box for the result. It also includes code for radio buttons to select the operator of addition, subtraction, multiplication, or division and a button to calculate the result. The calculate button code performs the math operation based on the selected operator and displays the result. There is also a "Try Again" button to clear the fields.
The document describes a simple calculator program interface and code. It includes code to set up the interface with input boxes for two numbers and an output box for the result. It also includes code for radio buttons to select the operator of addition, subtraction, multiplication, or division and a button to calculate the result. The calculate button code performs the math operation based on the selected operator and displays the result. There is also a "Try Again" button to clear the fields.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online from Scribd
The document describes a simple calculator program interface and code. It includes code to set up the interface with input boxes for two numbers and an output box for the result. It also includes code for radio buttons to select the operator of addition, subtraction, multiplication, or division and a button to calculate the result. The calculate button code performs the math operation based on the selected operator and displays the result. There is also a "Try Again" button to clear the fields.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online from Scribd
Download as pptx, pdf, or txt
You are on page 1of 6
Kalkulator Sederhana
Oleh : Fatahul Arifin Bentuk Interface Rancangan Program
Dim bil1 As Integer
Dim bil2 As Integer Dim hasil As Single Dim operator As Integer '1 - Penjumlahan, 2 - Pengurangan, 3 - Perkalian dan 4 – Pembagian Private Sub Form_Load() txtBil1.Text = "" txtBil2.Text = "" txtHasil.Text = "" End Sub Private Sub optPembagian_Click() lblOperator.Caption = "/" operator = 4 End Sub Private Sub optPengurangan_Click() lblOperator.Caption = "-" operator = 2 End Sub
Private Sub optPenjumlahan_Click()
lblOperator.Caption = "+" operator = 1 End Sub
Private Sub optPerkalian_Click()
lblOperator.Caption = "X" operator = 3 End Sub Private Sub cmdHitung_Click() bil1 = txtBil1.Text bil2 = txtBil2.Text If operator = 1 Then hasil = bil1 + bil2 txtHasil.Text = hasil ElseIf operator = 2 Then hasil = bil1 - bil2 txtHasil.Text = hasil ElseIf operator = 3 Then hasil = bil1 * bil2 txtHasil.Text = hasil ElseIf operator = 4 Then hasil = CSng(bil1) / CSng(bil2) txtHasil.Text = hasil Else MsgBox "Anda belum memilih operator" End If End Sub Private Sub cmdLagi_Click() Dim jawab As Integer jawab = MsgBox("Anda ingin mencoba lagi?", vbYesNo) If jawab = vbYes Then txtBil1.Text = "" txtBil2.Text = "" txtHasil.Text = "" Else Unload Me End If End Sub
Aim_Write a program in VB that constructs a scientific calculator with Sine, Cosine, Tangent, Logarithm, 1_x (Reciprocal), and sqr (Square root) functions