VB: (3)
a) Write a program in visual basic that construct a
scientific calculator with
SIN,COS, TAN,LOG,1/X (reciprocal) and SQR (square root) function only.
Display the error messages as and when required.
b) Enter the program and verify proper execution
c) Obtain a hard copy of the listing by printing the ofFRM
same on the computer.
file.
sin CoS tan
log 1/% sqrt
2 3
4 5
7 9
clear
Dim a
Private Sub Command1_Click(0
a= Sin(Text1.Text)
Text1.Text = a
End Sub
Private Sub Command10_Click)
Text1.Text = Text1.Text + "4"
End Sub
Private Sub Command11 Click()
Text1.Text = Text1.Text + "5"
End Sub
Private Sub Command12_Click()
Text1.Text = Text1.Text + "6"
End Sub
Private Sub Command13 Click()
Text1.Text = Text1.Text + "7"
End Sub
Private Sub Command 14 Click()
Text1.Text = Text1.Text + "8"
End Sub
Private Sub Command15 CIlick()
Text1.Text = Text1.Text + "9"
End Sub
Private Sub Command16 Click)
Text1.Text = "0"
End Sub
Private Sub Command17 Click()
Text1.Text = Text1.Text + "0"
End Sub
Private Sub Command18 Click()
Text1.Text =
End Sub
Private Sub Command2_Click()
a=Cos(Text1.Text)
Text1.Text = a
End Sub
Private Sub Command3_Click()
a= Tan(Text1.Text)
Text1.Text =a
End Sub
Private Sub Command4 Click()
If Text1.Text > 0 Then
a= Log(Text1.Text)
Text1.Text = a
Else:
a= MsgBox('error:- The no. should be greater than zero!")
End If
End Sub
Drivate Sub Command5 Click()
If Text1.Text = 0 Then
a= MsgBox('error:- The no should be other than zero")
Else
a= Val(1 /Text1.Text)
Text1.Text = a
End If
End Sub
Private Sub Command6 Click()
If Text1.Text <= 0 Then
a=MsgBox('error:-The no. should be positive")
Else
a= Sqr(Text1.Text)
Text1.Text = a
End If
End Sub
Private Sub Command7 Click()
Text1.Text = Text1.Text + "1"
End Sub
Private Sub Command8 Click()
Text1.Text =Text1.Text + "2"
End Sub
Private Sub Command9 Click()
Text1.Text
End Sub
=
Text1.Text + "3"