0% found this document useful (0 votes)
152 views16 pages

Hci Lab Mid Exam

The document provides the code for a scientific calculator application created in Visual Basic. The code includes functions for numerical buttons, arithmetic operations, trigonometric functions, exponents, logarithms, and other calculations. It takes user input, performs the selected operation, and displays the result.

Uploaded by

aleena ali
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)
152 views16 pages

Hci Lab Mid Exam

The document provides the code for a scientific calculator application created in Visual Basic. The code includes functions for numerical buttons, arithmetic operations, trigonometric functions, exponents, logarithms, and other calculations. It takes user input, performs the selected operation, and displays the result.

Uploaded by

aleena ali
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

HCI LAB MID EXAM

SP19-BCS-120
ALEENA ALI
BCS-6D

******************************************************************************

QUESTION#01
Create a fully functional Scientific Calculator as interactive design is provided in below given
image in Visual Basic. Copied solution will not be acceptable and considered as “USE OF
UNFAIR MEANS” / cancelled.  
FORM SS:
CODE SS:
CODE:
Public Class Form1
Dim FirstNumber As Single
Dim SecondNumber As Single
Dim AnswerNumber As Single
Dim ArithemeticProcess As String

Private Sub Button29_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "0"
End Sub

Private Sub Button34_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "1"
End Sub

Private Sub Button33_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "2"
End Sub

Private Sub Button32_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "3"
End Sub

Private Sub Button39_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "4"
End Sub

Private Sub Button38_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "5
"
End Sub

Private Sub Button37_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "6"
End Sub

Private Sub Button44_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "7"
End Sub

Private Sub Button43_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "8"
End Sub

Private Sub Button42_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = [Link] & "9"
End Sub

Private Sub Button41_Click(sender As Object, e As EventArgs) Handles [Link]


FirstNumber = Val([Link])
[Link] = "0"
ArithemeticProcess = "+"
End Sub

Private Sub Button35_Click(sender As Object, e As EventArgs) Handles [Link]


FirstNumber = Val([Link])
[Link] = "0"
ArithemeticProcess = "-"
End Sub

Private Sub Button40_Click(sender As Object, e As EventArgs) Handles [Link]


FirstNumber = Val([Link])
[Link] = "0"
ArithemeticProcess = "*"
End Sub

Private Sub Button31_Click(sender As Object, e As EventArgs) Handles [Link]


FirstNumber = Val([Link])
[Link] = "0"
ArithemeticProcess = "/"
End Sub

Private Sub Button26_Click(sender As Object, e As EventArgs) Handles [Link]


SecondNumber = Val([Link])
If ArithemeticProcess = "+" Then
AnswerNumber = FirstNumber + SecondNumber
End If
SecondNumber = Val([Link])
If ArithemeticProcess = "-" Then
AnswerNumber = FirstNumber - SecondNumber
End If
SecondNumber = Val([Link])
If ArithemeticProcess = "*" Then
AnswerNumber = FirstNumber * SecondNumber
End If
SecondNumber = Val([Link])
If ArithemeticProcess = "/" Then
AnswerNumber = FirstNumber / SecondNumber
End If
[Link] = AnswerNumber
End Sub

Private Sub Button47_Click(sender As Object, e As EventArgs) Handles [Link]


[Link]()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles [Link]


Dim aSin As Double
aSin = [Link]([Link])
aSin = [Link](aSin)
[Link] = [Link](aSin)

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles [Link]


Dim aCos As Double
aCos = [Link]([Link])
aCos = [Link](aCos)
[Link] = [Link](aCos)
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles [Link]


Dim aTan As Double
aTan = [Link]([Link])
aTan = [Link](aTan)
[Link] = [Link](aTan)
End Sub

Private Sub Button13_Click(sender As Object, e As EventArgs) Handles [Link]


Dim apow As Double
apow = [Link]([Link])
apow = [Link](apow, 2)
[Link] = [Link]()
End Sub

Private Sub Button12_Click(sender As Object, e As EventArgs) Handles [Link]


Dim apow As Double
apow = [Link]([Link])
apow = [Link](apow, 3)
[Link] = [Link]()
End Sub

Private Sub Button17_Click(sender As Object, e As EventArgs) Handles [Link]


Dim res As Double
res = [Link]([Link])
res = 1 / res
[Link] = [Link]()
End Sub

Private Sub Button9_Click(sender As Object, e As EventArgs) Handles [Link]


Dim res As Double
res = [Link]([Link])
res = Math.Log10(res)
[Link] = [Link]()
End Sub

Private Sub Button8_Click(sender As Object, e As EventArgs) Handles [Link]


Dim ln As Double
ln = [Link]([Link])
ln = [Link](ln)
[Link] = [Link]()
End Sub

Private Sub Button14_Click(sender As Object, e As EventArgs) Handles [Link]


Dim res As Double
res = [Link]([Link])
res = res * res
[Link] = [Link]()
End Sub

Private Sub Button21_Click(sender As Object, e As EventArgs) Handles [Link]


If [Link] > 0 Then
[Link] = [Link]([Link] - 1, 1)
End If
End Sub

Private Sub Button7_Click(sender As Object, e As EventArgs) Handles [Link]


Dim val As Double = CDbl([Link])
Dim FactVal As Double = 1
If (val = 1) Then
[Link] = "1"
Else
For i = 1 To val
FactVal = FactVal * i
Next
End If
[Link] = [Link]
End Sub

End Class

******************************THE END************************************

You might also like