dim studentnum, y as integer
dim eng(99), math(99), sci(99), maximum(2), minimum(2), sum(2) as integer
dim average(2) as integer
dim studentnum_valid, data_invalid as boolean
console.writeline("Enter number of students in class:")
studentnum=console.readline()
if ex.message = "Thread was being aborted." then
console.writeline("You have entered a letter or symbol. Please try again.")
if studentnum_valid = true
console.writeline("The number you entered was invalid. Please try again.")
loop until studentnum_valid=true
for repeat = 1 to studentnum
console.writeline("Input data for student " & repeat & ". Please enter in the order: Student ID, English, Maths, Science.")
inputmarks=console.readline()
std=inputmarks.split(",")
std(1)=convert.ToInt32(std(1))
std(2)=convert.ToInt32(std(2))
std(3)=convert.toInt32(std(3))
if ex.message = "Thread was being aborted." then
console.writeline("Data entry incorrect. Please try again.")
if std.GetLength(0) <> 4 then
console.writeline("You've added too many or too few values. Please re-enter.")
if std(0).length <> 5 then
console.writeline("ID length invalid. Please re-enter.")
if std(1) > 100 or std(2) > 100 or std(3) > 100 then
console.writeline("Results entered are invalid. Please re-enter.")
if std(1) < 0 or std(2) < 0 or std(3) < 0 then
console.writeline("Results entered are invalid. Please re-enter")
Console.writeline("You've already entered that student's results. Try again")
loop until data_invalid=false
math(repeat - 1) = std(2)
sum(1) = math(y) + sum(1)
if eng(y) > maximum(0) then
if eng(y) < minimum(0) then
if math(y) > maximum(1) then
if math(y) < minimum(1) then
if sci(y) > maximum(2) then
if sci(y) < minimum(2) then
average(0) = sum(0) / studentnum
average(1) = sum(1) / studentnum
average(2) = sum(2) / studentnum
Console.writeline("{0,-8}{1,-13}{2,-10}{3,-13}", "ID", "English", "Math", "Science")
Console.writeline("--------------------------------------------")
For i = 0 to studentnum - 1
Console.writeline("{0,-8}{1,-13}{2,-10}{3,-13}", id(y), eng(y), math(y), sci(y))
Console.writeline("{0,-8}{1,-13}{2,-10}{3,-13}", "Average", average(0), average(1), average(2))
Console.writeline("{0,-8}{1,-13}{2,-10}{3,-13}", "Max", maximum(0), maximum(1), maximum(2))
Console.writeline("{0,-8}{1,-13}{2,-10}{3,-13}", "Min", minimum(0), minimum(1), minimum(2))
Dim inputerror as boolean = false
Dim IDfound as boolean = false
Dim TheEnd as boolean = false
Console.writeline("Please input the ID of the student who's data you would like to see.")
IDsearch = Console.readline()
if IDsearch.length <> 5 then
Console.writeline("ID invalid. Please input a five digit ID.")
For i = 0 to studentnum - 1
console.writeline("We're unable to find data under ID: " & IDsearch & "Please retry")
console.writeline("Here's what we found:")
console.writeline("{0,-8}{1,-13}{2,-10}{3,-13}", "ID", "English", "Math", "Science")
console.writeline("--------------------------------------------")
console.writeline("{0,-8}{1,-13}{2,-10}{3,-13}", ID(data), eng(data), math(data), sci(data))
console.writeline("Would you like to see another student's data? Please input either YES or NO")
repeat = console.readline()
Select case repeat.toupper
Console.writeline("You didn't input yes or no.")
Loop until finished = true