Securing Higher Grades Costing Your Pocket? Book Your Course help Tutor at The Lowest Price Now!

Get Instant Course Help

Aliens Movement Code

this initializes the array to all zeros

For I = 0 To 14

MaleV(I) = 0

FemaleV(I) = 0

TotalV(I) = 0

Next I

this starts reading the file

Do While Vote.Peek <> -1

Belief = Vote.ReadLine

Sex = Vote.ReadLine

Age = Vote.ReadLine

If Sex = "M" Then

Select Case Belief

Case "Y"

MaleV(4) += 1

Select Case Age

Case 1

MaleV(0) += 1

Do You Want A Fresh Assignment Like This Order Now

Case 21

MaleV(1) += 1

Case 35

MaleV(2) += 1

Case 65

MaleV(3) += 1

End Select

Case "N"

MaleV(9) += 1

Select Case Age

Case 1

MaleV(5) += 1

Case 21

MaleV(6) += 1

Case 35

MaleV(7) += 1

Case 65

MaleV(8) += 1

End Select

Case "M"

MaleV(14) += 1

Select Case Age

Case 1

MaleV(10) += 1

Case 21

MaleV(11) += 1

Case 35

MaleV(12) += 1

Case 65

MaleV(13) += 1

End Select

End Select

Else

female code goes in here

End If

Loop

Vote.Close()

thios code moves the votes to the labels

For I = 0 To 14

LblMaleV(I).Text = MaleV(I)

LblFemaleV(I).Text = FemaleV(I)

TotalV(I) = MaleV(I) + FemaleV(I)

LblTotalV(I).Text = TotalV(I)

Next I

TotalVotes = TotalV(4) + TotalV(9) + TotalV(14)

this code makes sure we don't divide by zero

If MaleV(4) > 0 Then

For I = 0 To 4

MaleP(I) = MaleV(I) / MaleV(4)

MaleP(I) = MaleV(I) / TotalVotes

Next I

End If

If MaleV(9) > 0 Then

For I = 5 To 9

MaleP(I) = MaleV(I) / MaleV(9)

MaleP(I) = MaleV(I) / TotalVotes

Next I

End If

If MaleV(14) > 0 Then

For I = 10 To 14

MaleP(I) = MaleV(I) / MaleV(14)

MaleP(I) = MaleV(I) / TotalVotes

Next I

End If

insert female and total "divide by zero code

For I = 0 To 14

LblMaleP(I).Text = Format(MaleP(I), "Percent")

LblFemaleP(I).Text = Format(FemaleP(I), "Percent")

LblTotalP(I).Text = Format(TotalP(I), "Percent")

Next I

End Sub

Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click

Me.Close()

End Sub

End Class

Visual Basic Course Help | Aliens Movement Code Course Help | Aliens Movement Code Online Help | Aliens Movement Code Homework Help | Visual Basic | Study Visual Basic | Visual Basic Online Tutor | Visual Basic Homework Help | Visual Basic Help | Visual Basic Solutions | Visual Basic Problems | Visual Basic Tutor | Visual Basic Online Tutoring | Tutoring Services | Private Tutors | Writing Help | Term Paper Help | Course Help | Online Tutoring | Sample Homework

Course Help Features
Course Help Services
QR Code Course Help
elearningfeeds