Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Dim user As String
- Dim apass As String
- Sub Main()
- login()
- End Sub
- Sub login()
- Dim choice As Integer
- Do
- Console.WriteLine("-----------LOGIN MENU-----------")
- Console.WriteLine("Please choose an option from below")
- Console.WriteLine("1 - Admin Login")
- Console.WriteLine("2 - Student Login")
- Console.WriteLine("9- Exit")
- Console.Write("Please Enter Your Choice: ")
- choice = Console.ReadLine
- Select Case choice
- Case "1"
- loginadmin()
- Case "2"
- loginstudent()
- Case "9"
- Exit Do
- Case Else
- Console.WriteLine("Please Enter A Vaild Option")
- End Select
- Loop Until choice = "1" Or "2" Or "9"
- End Sub
- Sub loginadmin()
- Console.WriteLine("-----------ADMIN LOGIN-----------")
- Console.Write("Username: ")
- user = Console.ReadLine()
- Console.Write("Password: ")
- apass = Console.ReadLine
- If apass = "Admin" And user = "Admin" Then
- AdminMenu()
- Else
- Console.Write("Wrong Login Credentials, Press ENTER To Try Again")
- Console.ReadLine()
- loginadmin()
- End If
- End Sub
- Sub loginstudent()
- Console.WriteLine("-----------STUDENT LOGIN-----------")
- Console.Write("Username: ")
- user = Console.ReadLine()
- If user.Contains("y3") Then
- Testy3()
- ElseIf user.Contains("y4") Then
- Testy4()
- ElseIf user.Contains("y5") Then
- Testy5()
- ElseIf user.Contains("y6") Then
- Testy6()
- End If
- End Sub
- Sub AdminMenu()
- Dim choice As Integer
- Dim mark As Integer
- mark = 0
- Do
- Console.WriteLine("-----------ADMIN MENU-----------")
- Console.WriteLine("Please choose an option from below")
- Console.WriteLine("1 - Set Test For Year 3")
- Console.WriteLine("2 - Set Test For Year 4")
- Console.WriteLine("3 - Set Test For Year 5")
- Console.WriteLine("4 - Set Test For Year 6")
- Console.WriteLine("5 - Look At Test Results")
- Console.WriteLine("9 - Exit")
- Console.Write("Please Enter Your Choice: ")
- choice = Console.ReadLine
- Select Case choice
- Case "1"
- Settesty3()
- Case "2"
- Settesty4()
- Case "3"
- Settesty5()
- Case "4"
- Settesty6()
- Case "5"
- listresults()
- Case "9"
- Exit Do
- Case Else
- Console.WriteLine("Please enter a valid option")
- End Select
- Loop Until choice = "9"
- FileOpen(1, CurDir() & "\users.csv", OpenMode.Append)
- Dim fullline As String = user & "," & mark
- PrintLine(1, fullline)
- FileClose(1)
- End Sub
- Sub Settesty3()
- Dim word(10) As String
- Dim definition(10) As String
- Console.WriteLine("-----------SET TEST - YEAR 3-----------")
- For i As Integer = 1 To 10
- Console.Write("Enter " & i & "st Word: ")
- word(i) = Console.ReadLine()
- Next
- For a As Integer = 1 To 10
- Console.Write("Enter The Definiton For The " & a & "st Word: ")
- definition(a) = Console.ReadLine()
- Next
- FileOpen(1, CurDir() & "\testy3.csv", OpenMode.Output)
- For e = 1 To 10
- Dim fullline As String = word(e) & "," & definition(e)
- PrintLine(1, fullline)
- Next
- FileClose(1)
- End Sub
- Sub Testy3()
- Dim word(10) As String
- Dim definition(10) As String
- Dim noofrecords As Integer
- Dim items() As String
- Dim answer(10) As String
- Dim mark As Integer
- Dim total As Integer
- total = 20
- mark = 0
- noofrecords = 0
- FileOpen(1, CurDir() & "\testy3.csv", OpenMode.Input)
- Do Until EOF(1)
- noofrecords += 1
- Dim fullline As String = LineInput(1)
- items = Split(fullline, ",")
- word(noofrecords) = items(0)
- definition(noofrecords) = items(1)
- Loop
- FileClose(1)
- Console.WriteLine("-----------DEFINITIONS-----------")
- For i = 1 To 10
- Console.WriteLine(i & ": " & definition(i))
- Next
- Console.WriteLine("-----------TEST TIME-----------")
- Console.WriteLine("Enter your answers for the definitions 1 - 10 below:")
- For e = 1 To 10
- Console.Write(e & ": ")
- answer(e) = Console.ReadLine
- Next
- For j = 1 To 10
- If word(j) = answer(j) Then
- mark = mark + 2
- End If
- Next
- FileOpen(1, CurDir() & "\users.csv", OpenMode.Append)
- Dim fullline1 As String = user & "," & mark & "," & total
- PrintLine(1, fullline1)
- FileClose(1)
- Console.Write("Your total score was" & mark & "/" & total & ", Press enter to close the test.")
- Console.ReadLine()
- End Sub
- Sub Settesty4()
- Dim word(10) As String
- Dim definition(10) As String
- Console.WriteLine("-----------SET TEST - YEAR 4-----------")
- For i As Integer = 1 To 10
- Console.Write("Enter " & i & "st Word: ")
- word(i) = Console.ReadLine()
- Next
- For a As Integer = 1 To 10
- Console.Write("Enter The Definiton for the " & a & "st Word: ")
- definition(a) = Console.ReadLine()
- Next
- FileOpen(1, CurDir() & "\testy4.csv", OpenMode.Output)
- For e As Integer = 1 To 10
- Dim fullline As String = word(e) & "," & definition(e)
- PrintLine(1, fullline)
- Next
- FileClose(1)
- End Sub
- Sub Testy4()
- Dim word(10) As String
- Dim definition(10) As String
- Dim noofrecords As Integer
- Dim items() As String
- Dim answer(10) As String
- Dim mark As Integer
- Dim total As Integer
- total = 20
- mark = 0
- noofrecords = 0
- FileOpen(1, CurDir() & "\testy4.csv", OpenMode.Input)
- Do Until EOF(1)
- noofrecords += 1
- Dim fullline As String = LineInput(1)
- items = Split(fullline, ",")
- word(noofrecords) = items(0)
- definition(noofrecords) = items(1)
- Loop
- FileClose(1)
- Console.WriteLine("-----------TEST TIME-----------")
- For i = 1 To 10
- Console.WriteLine(i & ": " & definition(i))
- Next
- Console.WriteLine("-----------PRESS ENTER TO CONTINUE-----------")
- Console.WriteLine("Enter your answers for definitions 1 - 10 below:")
- For e = 1 To 10
- Console.Write(e & ": ")
- answer(e) = Console.ReadLine
- Next
- For j = 1 To 10
- If word(j) = answer(j) Then
- mark = mark + 2
- End If
- Next
- FileOpen(1, CurDir() & "\users.csv", OpenMode.Append)
- Dim fullline1 As String = user & "," & mark & "," & total
- PrintLine(1, fullline1)
- FileClose(1)
- Console.Write("Your total score was" & mark & "/" & total & ", Press enter to close the test.")
- Console.ReadLine()
- End Sub
- Sub Settesty5()
- Dim word(10) As String
- Dim definition(10) As String
- Console.WriteLine("-----------TEST TIME-----------")
- For i As Integer = 1 To 10
- Console.Write("Enter " & i & "st Word: ")
- word(i) = Console.ReadLine()
- Next
- For a As Integer = 1 To 10
- Console.Write("Enter The Definiton for the " & a & "st Word: ")
- definition(a) = Console.ReadLine()
- Next
- FileOpen(1, CurDir(), "\testy5.csv", OpenMode.Output)
- For e As Integer = 1 To 10
- Dim fullline As String = word(e) & "," & definition(e)
- PrintLine(1, fullline)
- Next
- FileClose(1)
- End Sub
- Sub Testy5()
- Dim word(10) As String
- Dim definition(10) As String
- Dim noofrecords As Integer
- Dim items() As String
- Dim answer(10) As String
- Dim mark As Integer
- Dim total As Integer
- total = 20
- mark = 0
- noofrecords = 0
- FileOpen(1, CurDir() & "\testy5.csv", OpenMode.Input)
- Do Until EOF(1)
- noofrecords += 1
- Dim fullline As String = LineInput(1)
- items = Split(fullline, ",")
- word(noofrecords) = items(0)
- definition(noofrecords) = items(1)
- Loop
- FileClose(1)
- Console.WriteLine("-----------TEST TIME-----------")
- For i = 1 To 10
- Console.WriteLine(i & ": " & definition(i))
- Next
- Console.WriteLine("-----------PRESS ENTER TO CONTINUE-----------")
- Console.WriteLine("Enter your answers for definitions 1 - 10 below:")
- For e = 1 To 10
- Console.Write(e & ": ")
- answer(e) = Console.ReadLine
- Next
- For j = 1 To 10
- If word(j) = answer(j) Then
- mark = mark + 2
- End If
- Next
- FileOpen(1, CurDir() & "\users.csv", OpenMode.Append)
- Dim fullline1 As String = user & "," & mark & "," & total
- PrintLine(1, fullline1)
- FileClose(1)
- Console.Write("Your total score was" & mark & "/" & total & ", Press enter to close the test.")
- Console.ReadLine()
- End Sub
- Sub Settesty6()
- Dim word(10) As String
- Dim definition(10) As String
- Console.WriteLine("-----------SET TEST - YEAR 6-----------")
- For i As Integer = 1 To 10
- Console.Write("Enter " & i & "st Word: ")
- word(i) = Console.ReadLine()
- Next
- For a As Integer = 1 To 10
- Console.Write("Enter The Definiton for the " & a & "st Word: ")
- definition(a) = Console.ReadLine()
- Next
- FileOpen(1, CurDir() & "\testy6.csv", OpenMode.Output)
- For e As Integer = 1 To 10
- Dim fullline As String = word(e) & "," & definition(e)
- PrintLine(1, fullline)
- Next
- FileClose(1)
- End Sub
- Sub Testy6()
- Dim word(10) As String
- Dim definition(10) As String
- Dim noofrecords As Integer
- Dim items() As String
- Dim answer(10) As String
- Dim mark As Integer
- Dim total As Integer
- total = 20
- mark = 0
- noofrecords = 0
- FileOpen(1, CurDir() & "\testy6.csv", OpenMode.Input)
- Do Until EOF(1)
- noofrecords += 1
- Dim fullline As String = LineInput(1)
- items = Split(fullline, ",")
- word(noofrecords) = items(0)
- definition(noofrecords) = items(1)
- Loop
- FileClose(1)
- Console.WriteLine("-----------DEFINITIONS-----------")
- For i = 1 To 10
- Console.WriteLine(i & ": " & definition(i))
- Next
- Console.WriteLine("-----------TEST TIME-----------")
- Console.WriteLine("Enter your answers for definition 1 - 10 below:")
- For e = 1 To 10
- Console.Write(e & ": ")
- answer(e) = Console.ReadLine
- Next
- For j = 1 To 10
- If word(j) = answer(j) Then
- mark = mark + 2
- End If
- Next
- FileOpen(1, CurDir() & "\users.csv", OpenMode.Append)
- Dim fullline1 As String = user & "," & mark & "," & total
- PrintLine(1, fullline1)
- FileClose(1)
- Console.Write("Your total score was " & mark & "/" & total & ", Press enter to close the test.")
- Console.ReadLine()
- End Sub
- Sub listresults()
- Dim noofrecords As Integer
- Dim items() As String
- Dim answer(10) As String
- Dim mark(999) As Integer
- Dim total As Integer
- Dim users(999) As String
- total = 20
- FileOpen(1, CurDir() & "\users.csv", OpenMode.Input)
- Do Until EOF(1)
- noofrecords += 1
- Dim fullline As String = LineInput(1)
- items = Split(fullline, ",")
- users(noofrecords) = items(0)
- mark(noofrecords) = items(1)
- Loop
- FileClose(1)
- Console.WriteLine("-----------RESULTS-----------")
- For i = 1 To noofrecords
- Console.WriteLine(users(i) & ": " & mark(i) & "/" & total)
- Next
- Console.ReadLine()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement