Public Class frmDensities

  Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
    DescribeTask()
    CalculateDensity("Hawaii", 1275194, 6471)
  End Sub

  Sub DescribeTask()
    lstOutput.Items.Clear()
    lstOutput.Items.Add("This program displays the")
    lstOutput.Items.Add("population density of the last state")
    lstOutput.Items.Add("to become part of the United States.")
  End Sub

  Sub CalculateDensity(ByVal state As String,
                       ByVal pop As Double, ByVal area As Double)
    Dim density As Double
    density = pop / area
    lstOutput.Items.Add("")
    lstOutput.Items.Add("The density of " & state & " is")
    lstOutput.Items.Add(FormatNumber(density, 1) & " people per square mile.")
  End Sub

End Class
