0% found this document useful (0 votes)
34 views

Assignment Number 3

The document describes two programs that contain math functions. The first program contains five basic math functions: addition, subtraction, multiplication, division, and rounding. The second program contains five additional math functions: arctangent, hyperbolic sine, hyperbolic cosine, hyperbolic tangent, and multiplication by Pi. Both programs take numeric user input, perform the selected math function, and display the output.

Uploaded by

Massive Legend
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Assignment Number 3

The document describes two programs that contain math functions. The first program contains five basic math functions: addition, subtraction, multiplication, division, and rounding. The second program contains five additional math functions: arctangent, hyperbolic sine, hyperbolic cosine, hyperbolic tangent, and multiplication by Pi. Both programs take numeric user input, perform the selected math function, and display the output.

Uploaded by

Massive Legend
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Nathaniell Morfie M. Doria Jr.

Assignment
BSCS - 1

Two programs that each have five different math functions

Source Code:

Public Class Form1


Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click

Dim First As Double

Dim Second As Double

Dim Total As Double

First = Val(txtFirst.Text)

Second = Val(txtSecond.Text)

Total = Val(lblTotal.text)

Total = First + Second

lblTotal.Text = Total

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


btnSubtract.Click

Dim First As Double

Dim Second As Double

Dim Total As Double

First = Val(txtFirst.Text)

Second = Val(txtSecond.Text)

Total = Val(lblTotal.Text)

Total = First - Second

lblTotal.Text = Total

End Sub

Private Sub btnMultiply_Click(sender As Object, e As EventArgs) Handles


btnMultiply.Click

Dim First As Double

Dim Second As Double

Dim Total As Double

First = Val(txtFirst.Text)

Second = Val(txtSecond.Text)
Total = Val(lblTotal.Text)

Total = First * Second

lblTotal.Text = Total

End Sub

Private Sub btnDivide_Click(sender As Object, e As EventArgs) Handles


btnDivide.Click

Dim First As Double

Dim Second As Double

Dim Total As Double

First = Val(txtFirst.Text)

Second = Val(txtSecond.Text)

Total = Val(lblTotal.Text)

Total = First / Second

lblTotal.Text = Total

End Sub

Private Sub btnRound_Click(sender As Object, e As EventArgs) Handles


btnRound.Click

lblTotal.Text = Math.Round(Val(lblTotal.Text), 2)

End Sub

Private Sub btnLog_Click(sender As Object, e As EventArgs) Handles btnLog.Click

lblTotal.Text = Math.Log(lblTotal.Text)

End Sub

Private Sub btnSin_Click(sender As Object, e As EventArgs) Handles btnSin.Click

lblTotal.Text = Math.Sin(lblTotal.Text)

End Sub

Private Sub btnCos_Click(sender As Object, e As EventArgs) Handles btnCos.Click

lblTotal.Text = Math.Cos(lblTotal.Text)

End Sub
Private Sub btnTan_Click(sender As Object, e As EventArgs) Handles btnTan.Click

lblTotal.Text = Math.Tan(lblTotal.Text)

End Sub

Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles


btnClear.Click

lblTotal.Text = "0"

End Sub

End Class
Source Code:

Public Class Form1

Private Sub btnin_Click(sender As Object, e As EventArgs) Handles btnatan.Click

lblTotal.Text = Math.Atan(txtFirst.Text)

End Sub

Private Sub btnsinh_Click(sender As Object, e As EventArgs) Handles


btnsinh.Click

lblTotal.Text = Math.Sinh(txtSecond.Text)

End Sub

Private Sub btncosh_Click(sender As Object, e As EventArgs) Handles


btncosh.Click

lblTotal.Text = Math.Cosh(txtThird.Text)

End Sub

Private Sub btntanh_Click(sender As Object, e As EventArgs) Handles


btntanh.Click

lblTotal.Text = Math.Tanh(txtFourth.Text)

End Sub

Private Sub btnPi_Click(sender As Object, e As EventArgs) Handles btnPi.Click

lblTotal.Text = (3.14159 * lblTotal.Text)

lblTotal.Text = Math.Round(Val(lblTotal.Text), 2)

End Sub

Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles


btnClear.Click

lblTotal.Text = "0"
End Sub

End Class

You might also like