Dim ClassVotes(29) as integer
Dim Candidate1 as integer
Dim Candidate2 as integer
Dim Candidate3 as integer
Dim Candidate4 as integer
Dim Candidate1Name as string = "N"
Dim Candidate2Name as string = "N"
Dim Candidate3Name as string = "N"
Dim Candidate4Name as string = "N"
Dim Winner as string = "No overall Winner"
console.writeline("Welcome to Candidate Vote Calculator")
console.writeline("Please input the number of candidates")
Start: NumberC = console.readline()
if NumberC > 4 or NumberC <= 1 then
console.writeline("Error please re-input number of candidates")
console.writeline("Input names of the two candidates")
Candidate1Name = console.readline()
Candidate2Name = console.readline()
console.writeline("Input names of the three candidates")
Candidate1Name = console.readline()
Candidate2Name = console.readline()
Candidate3Name = console.readline()
console.writeline("Input names of the four candidates")
Candidate1Name = console.readline()
Candidate2Name = console.readline()
Candidate3Name = console.readline()
Candidate4Name = console.readline()
TwoCandidates: console.writeline("Please input the number of votes " & Candidate1Name & " recived.")
Start2: Candidate1= console.readline()
console.writeline("Please input the number of votes " & Candidate2Name & " recived.")
Candidate2 = console.readline()
if Candidate1 + Candidate2 > 30 then
console.writeline("Error please re-input your votes")
console.writeline("The Number of votes " & Candidate1Name & " received is " & Candidate1)
console.writeline("The Number of votes " & Candidate2Name & " received is " & Candidate2)
if Candidate1 > Candidate2 then
else if Candidate2 > Candidate1 then
console.writeline("The candidate who won was " & Winner)
ThreeCandidates: console.writeline("Please input the number of votes " & Candidate1Name & " recived.")
Start3: Candidate1= console.readline()
console.writeline("Please input the number of votes " & Candidate2Name & " recived.")
Candidate2 = console.readline()
console.writeline("Please input the number of votes " & Candidate3Name & " recived.")
Candidate3 = console.readline()
if Candidate1 + Candidate2 + Candidate3 > 30 then
console.writeline("Error please re-input your votes")
console.writeline("The Number of votes " & Candidate1Name & " received is " & Candidate1)
console.writeline("The Number of votes " & Candidate2Name & " received is " & Candidate2)
console.writeline("The Number of votes " & Candidate3Name & " received is " & Candidate3)
if Candidate1 > Candidate2 and Candidate3 then
else if Candidate2 > Candidate1 and Candidate3 then
else if Candidate3 > Candidate1 and Candidate2 then
console.writeline("The candidate who won was " & Winner)
FourCandidates: console.writeline("Please input the number of votes " & Candidate1Name & " recived.")
Start4: Candidate1= console.readline()
console.writeline("Please input the number of votes " & Candidate2Name & " recived.")
Candidate2 = console.readline()
console.writeline("Please input the number of votes " & Candidate3Name & " recived.")
Candidate3 = console.readline()
console.writeline("Please input the number of votes " & Candidate4Name & " recived.")
Candidate4 = console.readline()
if Candidate1 + Candidate2 + Candidate3 + Candidate4 > 30 then
console.writeline("Error please re-input your votes")
console.writeline("The Number of votes " & Candidate1Name & " received is " & Candidate1)
console.writeline("The Number of votes " & Candidate2Name & " received is " & Candidate2)
console.writeline("The Number of votes " & Candidate3Name & " received is " & Candidate3)
console.writeline("The Number of votes " & Candidate4Name & " received is " & Candidate4)
if Candidate1 > Candidate2 and Candidate3 and Candidate4 then
else if Candidate2 > Candidate1 and Candidate3 and Candidate4 then
else if Candidate3 > Candidate1 and Candidate2 and Candidate4 then
else if Candidate4 > Candidate1 and Candidate2 and Candidate3 then
console.writeline("The candidate who won was " & Winner)
En: console.writeline("Done")