Complete Case Programming Assignment Largest Cities in the United States,

FratBro23
Category:
Programming
Price: $5 USD

Question description

Complete Case Programming Assignment Largest Cities in the United States

I need help fixing my code.

New form just gives a list of the cities and populations. 
( Code ) 
Imports System 
Imports System.IO 

Public Class Population 
Private _List As Integer = 5 
Public Shared _cityArray(9) As String 
Public Shared _cityPopulationArray(9) As Integer 

Private Sub Population_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
Dim objReader As IO.StreamReader 
' Dim strwriter As IO.StreamWriter 
Dim intCount As Integer = 0 
Dim intFill As Integer 
Dim strErrorMsg As String = " Error reading file, try again!" 


'OPENS TEXT FILE 
If IO.File.Exists("..\\..\\Cities.txt") = True Then 
objReader = IO.File.OpenText("..\\..\\Cities.txt") 
'READS TEXT FILE 
Do While objReader.Peek <> -1 
_cityArray(intCount) = objReader.ReadLine() 'assigns 1st element 
_cityPopulationArray(intCount) = Convert.ToInt32(objReader.ReadLine()) 'assigns 2nd element 
intCount += 1 ' repeat until no more data 
Loop 

objReader.Close() 
'inserts array into combo box 
For intFill = 0 To (_cityArray.Length - 1) 
Me.cboCities.Items.Add(_cityArray(intFil... 
Next 
Else 
MsgBox(strErrorMsg, , "Error") 
Me.Close() 
End If 

'ACCESSING 
'Dim popIncrease As Decimal = _cityPopulationArray(intCount) 
'Dim citySelection As String = _cityArray(intCount) 




End Sub 

Private Sub mnuDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDisplay.Click 
'displays new window form for list of largest cities 
Dim largestCityList As New frmDisplayCity 
'display 2nd form window until closed b4 access to 1st window code 
Me.Hide() 
largestCityList.ShowDialog() 
End Sub 

Private Sub mnuClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuClear.Click 
cboCities.SelectedItem = (0) 
End Sub 

Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click 
Me.Close() 
End Sub 

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click 

Dim populationIncrease As Single 
Const popIncrease As Decimal = 0.3D 

If Me.cboCities.SelectedIndex <> -1 Then 
populationIncrease = _cityPopulationArray(cboCities.SelectedI... * popIncrease 
End If 
lstDisplay.Text = populationIncrease.ToString 
lblCurrent.Text = "The present population is " & _cityPopulationArray(cboCities.SelectedI... 

End Sub 
End Class 

Cities file 
New York 
8175133 
Los Angeles 
3792621 
Chicago 
2695598 
Houston 
2099451 
Philadelphia 
1526006 
Phoenix 
1445632 
San Antonio 
1327407 
San Diego 
1307402 
Dallas 
1197816 
San Jose 
945942 


Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1825 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors