Sei sulla pagina 1di 4

Public Class Form1

Dim blnBD As Boolean


Private Sub actual(ByVal dblBD As Double, ByVal dblPop As Double)
Dim dblAnswer As Double = (dblBD * 365) / dblPop
Dim strType As String

If blnBD = False Then


strType = "Death"
Else
strType = "Birth"
End If

lblOutput.Text = "The Actual " & strType & " is " & dblAnswer.ToString("0.00%")

End Sub
Private Sub CrudeBirthRateToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CrudeBirthRateToolStripMenuItem.Click
Try
Dim dblbirths As Double = InputBox("Enter Number of births a day")
Dim dblyear As Double = InputBox("Enter number of years")
Dim dblcbr As Double = dblbirths / 1000 / dblyear
lblOutput.Text = "The CBR is " & dblcbr.ToString("0.00%")
Catch ex As Exception

End Try

End Sub

Private Sub CrudeDeathRateToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles CrudeDeathRateToolStripMenuItem.Click
Try
Dim dblDeaths As Double = InputBox("Enter Number of Deaths a day")
Dim dblyear As Double = InputBox("Enter number of years")
Dim dblcdr As Double = dblDeaths / 1000 / dblyear
lblOutput.Text = "The CDR is " & dblcdr.ToString("0.00%")
Catch ex As Exception

End Try

End Sub

Private Sub ActualBirthRateToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles ActualBirthRateToolStripMenuItem.Click
Try
blnBD = True
Dim dblBirth As Double = InputBox("Enter number of births per day")
Dim dblPop As Double = InputBox("Enter the total population")

Call actual(dblBirth, dblPop)

Catch ex As Exception

End Try
End Sub
Private Sub ActualDeathRateToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ActualDeathRateToolStripMenuItem.Click
Try
blnBD = False
Dim dblDeath As Double = InputBox("Enter number of Deaths per day")
Dim dblPop As Double = InputBox("Enter the total population")

Call actual(dblDeath, dblPop)

Catch ex As Exception

End Try
End Sub

Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles CloseToolStripMenuItem.Click
Application.Exit()
End Sub

Private Sub PopulationDensityToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles PopulationDensityToolStripMenuItem.Click
Try
Dim intPop As Integer = InputBox("Enter the population")
Dim intArea As Integer = InputBox("Enter the area in kilometers")
Dim intAnswer As Integer = intPop / intArea

lblOutput.Text = " The Population Density is " & intAnswer & " People per
square kilometer "
Catch ex As Exception

End Try

End Sub

Private Sub DoublingTimeOfAPopulationToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
DoublingTimeOfAPopulationToolStripMenuItem.Click

Try
Dim dblGrowthRate As Double = InputBox("Enter the growth rate")
Dim dblDoublingTime As Double = 70 / dblGrowthRate
lblOutput.Text = dblDoublingTime & " Years for the population to double."
Catch ex As Exception

End Try

End Sub

Private Sub NationalPopulationGrowthRateToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
NationalPopulationGrowthRateToolStripMenuItem.Click
Try
Dim dblCBR As Double = InputBox("Enter the Crude Birth Rate")
Dim dblim As Double = InputBox(" Enter the amount of immigration ")
Dim dblCDR As Double = InputBox("Enter the Crude Death Rate")
Dim dblEm As Double = InputBox(" Enter the amount of emmigration ")
Dim dblAnswer As Double = ((dblCBR + dblim) - (dblCDR + dblEm)) / 10

lblOutput.Text = "The National population growth rate is " & dblAnswer & "%"
Catch ex As Exception

End Try
End Sub

Private Sub GlobalPopulationGrowthRateToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
GlobalPopulationGrowthRateToolStripMenuItem.Click
Try
Dim dblCBR As Double = InputBox("Enter the Crude Birth Rate")
Dim dblCDR As Double = InputBox("Enter the Crude Death Rate")
Dim dblAnswer As Double = ((dblCBR) - (dblCDR)) / 10
lblOutput.Text = "The Global population growth rate is " & dblAnswer & "%"

Catch ex As Exception

End Try

End Sub

Private Sub NetPopulationGrowthRateToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
NetPopulationGrowthRateToolStripMenuItem.Click
Try
Dim dblBirths As Double = InputBox("Enter the number of Births a day")
Dim dblDeaths As Double = InputBox("Enter the number of deaths a day")
Dim dblPop As Double = InputBox("Enter the total population")
Dim dblAnswer As Double = ((dblBirths * 365) - (dblDeaths * 365)) / dblPop

lblOutput.Text = "The Net Population Growth is " &


dblAnswer.ToString("0.00%")
Catch ex As Exception

End Try

End Sub

Private Sub PopulationInTheFutureToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
PopulationInTheFutureToolStripMenuItem.Click
Try
Dim dblPop As Double = InputBox("Enter the total population")
Dim dblBirths As Double = InputBox("Enter the number of births per day")
Dim dblDeaths As Double = InputBox("Enter the number of Deaths per day")
Dim dblNat As Double = dblPop / (1000 * (dblBirths * 365))
Dim dblMor As Double = dblPop / (1000 * (dblDeaths * 365))
Dim dblEm As Double = InputBox("Enter the amount of emmigration")
Dim dblim As Double = InputBox("Enter the amount of immigration")

Dim dblFuture As Double = dblPop + (dblNat - dblMor) + (dblim - dblEm)


lblOutput.Text = "The future population will be " & dblFuture
Catch ex As Exception

End Try
End Sub

Private Sub ShowInforForWakeCountyToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
ShowInforForWakeCountyToolStripMenuItem.Click
picInfo.Image = My.Resources.wake_county
End Sub

Private Sub ClearToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles ClearToolStripMenuItem1.Click
lblOutput.Text = ""
picInfo.Image = Nothing
End Sub
End Class

Potrebbero piacerti anche