Convert temperature from degree Sample Assignment

1:To Convert temperature from degree centigrade to Fahrenheit and Fahrenheit to degree centigrade

Code:

{`
Public Class FtoCToF
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim c As Double
Dim f As Double
Dim temp1 As Double
Dim temp2 As Double
c = Convert.ToDouble(txtc.Text)
temp1 = 9 * c
temp2 = 5 + 32
f = temp1 / temp2
Labelf.Text = Convert.ToString(f)


End Sub

Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim c As Double
Dim f As Double
Dim temp1 As Single
Dim temp2 As Double
f = Convert.ToDouble(Textf.Text)
temp1 = (f - 32)
temp2 = 5 \ 9
c = temp1 * temp2
Labelc.Text = Convert.ToString(c)

End Sub
End Class
`}

2:To calculate Area, surface Area & volume of a sphere

Code:

{`
Public Class spherevolumeandArea
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim radius As Double

Dim surfacearea As Double
Dim volume As Double

radius = Convert.ToDouble(txtRadius.Text)



surfacearea = 4.0 * Math.PI * Math.Pow(radius, 2.0)

volume = 4.0 / 3.0 * Math.PI * Math.Pow(radius, 2.0)

IbIvolum.Text = Convert.ToString(volume)
IbIsufaceArea.Text = Convert.ToString(surfacearea)
End Sub
End Class
`}

3:To convert from kg to pound and KG to ounces,

Code:

{`
Public Class kgtooundKGtoounces
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim kg As Double
Dim pound As Double
Dim ounces As Double
kg = Convert.ToDouble(txtkg.Text)
pound = kg * 2.20462
ounces = kg * 35.27391
IbIPound.Text = Convert.ToString(pound)
IbIInchese.Text = Convert.ToString(ounces)
End Sub
End Class
`}

4:To calculate Quick ratio and Current Ratio

code:

{`
Public Class QuickratioCurrentratio
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim asset As Double
Dim liability As Double

asset = Convert.ToDouble(Val(txtasset.Text.ToString))
liability = Convert.ToSingle(Val(txtLiability.Text.ToString))
LabelCurrentratio.Text = Math.Round(asset / liability, 4)
End Sub

Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim Cash As Double
Dim liability As Double
Dim Marketablesecurities As Double
Dim tempresult As Double
Cash = Convert.ToDouble(Val(TextBoxCash.Text.ToString))
liability = Convert.ToSingle(Val(txtLiability.Text.ToString))
Marketablesecurities = Convert.ToSingle(Val(TextMarsc.Text.ToString))
tempresult = Convert.ToDouble(Cash + Marketablesecurities)
LabelQuickratio.Text = tempresult / liability
End Sub
End Class
`}

5:To calculate length of hypotenuse if the length of sides is known (Using Pythagoras theorem)

{`
Code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim AB, AC, BC As Single
AB = Val(TextBox1.Text)
AC = Val(TextBox2.Text)
BC = Val(TextBox3.Text)
If AB <> 0 And AC <> 0 Then
BC = Math.Sqrt(AB ^ 2 + AC ^ 2)
TextBox1.Text = Math.Round(BC, 2)
ElseIf AB <> 0 And BC <> 0 Then
AC = Math.Sqrt(BC ^ 2 - AB ^ 2)
TextBox2.Text = Math.Round(AC, 2)
ElseIf AC <> 0 And BC <> 0 Then
AB = Math.Sqrt(BC ^ 2 - AC ^ 2)
TextBox3.Text = Math.Round(AB, 2)
End If
End Sub
`}

6: To calculate Area, surface Area & Volume of cylinder?

{`
Code:
Public Class cylinder
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim radius As Double
Dim height As Double
Dim surfacearea As Double
Dim volume As Double

radius = Convert.ToDouble(txtRadius.Text)
height = Convert.ToDouble(txtHeight.Text)

volume = Math.PI * Math.Pow(radius, 2.0) * height
surfacearea = 2.0 * Math.PI * Math.Pow(radius, 2.0 * Math.PI * radius * height)

IbIvolum.Text = Convert.ToString(volume)
IbIsufaceArea.Text = Convert.ToString(surfacearea)
End Sub
End Class
`}

7:To convert length in Kilometers into miles ,inches & yards?

{`
Code:
Public Class LengtToKmToM_INCH
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim km As Double
Dim Miles As Double
Dim inches As Double
Dim yards As Double

km = Convert.ToDouble(txtkm.Text)

Miles = km * 1.61
inches = km * 39370.1
yards = km * 1093.61

IbIMiles.Text = Convert.ToString(Miles)
IbIInchese.Text = Convert.ToString(inches)
IbIYard.Text = Convert.ToString(yards)

End Sub
End Class
`}

8:To sum of digits of 3 digit number.

Code:

{`
Public Class Volumeofcylinder
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub


Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim firstdigit As Single
Dim seconddigit As Single
Dim thirddigit As Single

firstdigit = Convert.ToSingle(Val(TextBox1.Text.ToString))
seconddigit = Convert.ToSingle(Val(TextBox2.Text.ToString))
thirddigit = Convert.ToSingle(Val(TextBox3.Text.ToString))

labalSum.Text = Math.Round(firstdigit + seconddigit + thirddigit)

End Sub

End Class
`}

9:To convert Omani Riyal to US Dollar, Pound, & Euro

Code:

{`
Public Class OmanTousdpund
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim reyal As Double
Dim usd As Double
Dim pund As Double
Dim euro As Double
reyal = Convert.ToDouble(txtkm.Text)
usd = reyal * 2.6
pund = reyal * 2.07
euro = reyal * 2.28
IbIusd.Text = Convert.ToString(usd)
IbIpound.Text = Convert.ToString(pund)
IbIEuro.Text = Convert.ToString(euro)
End Sub
End Class
`}