imports Microsoft.VisualBasic
dim FirstNames(99) as string
dim Surnames(99) as string
dim VolunteerChoices(99) as integer
dim JoiningDates(99) as date
dim FeePaid(99) as boolean
dim VolunteerTypes = { "Not a volunteer",
"Painting and decorating"}
dim MembersToAdd as Boolean
dim ValidEntry as boolean
do while MembersToAdd AND Count < 100
'Populate our arrays at position (Count)
'promt to enter the first name
console.WriteLine("please enter the first name of the new member: ")
response = console.ReadLine()
'validate the entry with a presence check
console.WriteLine("Invalid entry - you must enter a value")
response = console.readline()
'add the value to the array
FirstNames(Count) = response
'promt to enter the surname
console.WriteLine("please enter the surname of the new member: ")
response = console.ReadLine()
'validate the entry with a presence check
console.WriteLine("Invalid entry - you must enter a value")
response = console.readline()
'add the value to the array
Surnames(Count) = response
'Promt to enter the volunteering option
Console.WriteLine("Enter " & n & " for " & VolunteerTypes(n))
response = console.ReadLine()
'validate the data entered
'type Check - make sure that the value entered is a number
If Not isnumeric(response) then
Console.WriteLine("Invalid entry - you must enter a number")
response = console.ReadLine()
'Range check - make sure that the value entered is between 0 and 3
elseif cint(response) < 0 OR cint(response)>3 then
Console.WriteLine("Invalid entry - you must enter a number in the range of 0 to 3")
response = console.ReadLine()
'Promt to enter the start day
Console.WriteLine("please enter the start date in the format 'DD/MMM/YYYY' (e.g. 05/dec/2020)")
response = console.ReadLine()
'validate the date that has just been entered
if not response.length = 11 then
console.WriteLine("the date entered is not the right length. Correctly formatted dates will have 11 characters")
response = console.ReadLine()
elseif not (response.Substring(2,1) = "/" and response.Substring(6,1) = "/") then
console.WriteLine("the date entered is not the right format. The 3rd and 7th characters should be '/'")
response = console.ReadLine()
elseif not isDate(response) then
Console.WriteLine("the date entered is not a valid date")
response = console.ReadLine()
'Range check 1 - in the future
elseif cdate(response) > Today then
Console.writeline("This date is invalid - it is in the future")
response = console.ReadLine()
'Range check 2 - too far in the past
elseif dateadd("yyyy",-4,Today) > cdate(response) then
Console.WriteLine("The date entered is too far in the past. All dates shoulbe be within the last four year.")
response = console.ReadLine()
'add the value to the array
JoiningDates(Count) = cdate(response)
'Prompt to enter whether the member has paid
Console.WriteLine("add details for member number - y/n?")
response = console.ReadLine()
do while not(response = "y" OR response = "n")
console.WriteLine("Invalid entry - please enter only 'y' or 'n' ")
response = console.ReadLine()
'Check to see if we need to set MembersToAdd to false
Console.WriteLine("add details for member number - y/n?")
response = console.ReadLine()
do while not(response = "y" OR response = "n")
console.WriteLine("Invalid entry - please enter only 'y' or 'n' ")
response = console.ReadLine()
Dim FirstNames(99) as string
Dim Surnames(99) as string
Dim JoiningDates(99) as date
Dim FeePaid(99) as boolean
Dim VolunteerTypes = { "Not a volunteer",
"Painting and decorating"}
dim MembersToAdd as boolean
dim ValidEntry as boolean
dim arrayIndex as integer
'set up a loop for task 2
Console.WriteLine("please enter your required option: ")
Console.WriteLine("================================== ")
Console.WriteLine("Enter 1 to list all member who have chosen to be volunteers, ")
Console.WriteLine("Enter 2 to list all volunteers who would like to work at the pier entrance gate")
Console.WriteLine("Enter 3 to list all volunteers who would like to work in the gift shop")
Console.WriteLine("Enter 4 to list all volunteers who would like to help with painting and decorating tasks. ")
Console.WriteLine("Enter 5 to list all members whose membership has expired")
Console.WriteLine("Enter 6 to list all members who have not yet paid their $75 fee.")
Console.WriteLine("Enter 0 to exit this program.")
'prompt for the response - a number in the range of 0 to 6
response = console.ReadLine()
'validate the data entered
'type Check - make sure that the value entered is a number
If Not isnumeric(response) then
Console.WriteLine("Invalid entry - you must enter a number")
response = console.ReadLine()
'Range check - make sure that the value entered is between 0 and 6
elseif cint(response) < 0 OR cint(response)> 6 then
Console.WriteLine("Invalid entry - you must enter a number in the range of 0 to 6")
response = console.ReadLine()
else if response = "1" then
console.WriteLine("All volunteers: ")
elseif response = "2" then
console.WriteLine("All pier entrance gate volnteers: ")
elseif response = "3" then
Console.WriteLine("All gift shop volunteers: ")
elseif response = "4" then
Console.WriteLine("All volunteers for painting and decorating: ")
elseif response = "5" then
Console.WriteLine("All members whose membership has expired: ")
elseif response = "6" then
Console.WriteLine("All members who have not paid their $75 fee: ")
if response <> "0" then '(0 means exit the loop
do while arrayIndex <= FirstNames.Length -1
if FirstNames(arrayIndex) <> "" then
'Display the first name and surname of all volunteers
'(i.e. anyone without a corresponding 0 in the VolunteerChoices array)
if not VolunteerChoices(arrayIndex) = 0 then
Console.WriteLine(FirstNames(arrayIndex) & " " & Surnames(arrayIndex) )
elseif CInt(response) > 1 AND CInt(response) < 5 then
'display the first name and surname of specific volunteers
'they will have (CInt(response) - 1) in the corresponding position in the Volunteering choices array
if VolunteerChoices(arrayIndex) = CInt(response) - 1 then
console.WriteLine(FirstNames(arrayIndex) & " " & Surnames(arrayIndex))
elseif response = "5" then
'list everyone whose joining date is more than one year old
'i.e. where DateAdd("yyyy", 1, JoiningDates(arrayIndex)) < Today
if DateAdd("yyyy" , 1, JoiningDates(arrayIndex)) < Today
console.WriteLine(FirstNames(arrayIndex) & " " & Surnames(arrayIndex))
elseif response = "6" then
'list everyone with the value False in the FeedPaid Array
if not FeePaid(arrayIndex) then
console.WriteLine(FirstNames(arrayIndex) & " " & Surnames(arrayIndex))
arrayIndex = arrayIndex + 1
Dim FirstNames(99) as string
Dim Surnames(99) as string
Dim JoiningDates(99) as date
Dim FeePaid(99) as boolean
Dim VolunteerTypes = { "Not a volunteer",
"Painting and decorating"}
dim MembersToAdd as boolean
dim ValidEntry as boolean
dim arrayIndex as integer
dim SponsorFirstNames(99) as string
dim SponsorSurname(99) as string
dim PlaqueMessages(99) as string
dim SponsorFeePaid(99) as boolean
dim inputConfirmed as boolean
dim tmpFirstName as string
console.writeline("Enter 1 to add or view member details")
console.WriteLine("Enter 2 to add sponser details")
response = console.ReadLine()
'validate the option choice
'type check - make sure that the value entered is a number
If not isnumeric(response) then
console.WriteLine("Invalid entry - you must enter a number")
response = console.ReadLine()
elseif CInt(response) < 1 or CInt(response) > 2 then
Console.writeline("Invalid entry - you must enter either 1 or 2")
response = console.readline()
'we are dealing with member details
'set up a loop for task 2
do while MembersToAdd AND Count < 100
'Populate our arrays at position (Count)
'promt to enter the first name
console.WriteLine("please enter the first name of the new member: ")
response = console.ReadLine()
'validate the entry with a presence check
console.WriteLine("Invalid entry - you must enter a value")
response = console.readline()
'add the value to the array
FirstNames(Count) = response
'promt to enter the surname
console.WriteLine("please enter the surname of the new member: ")
response = console.ReadLine()
'validate the entry with a presence check
console.WriteLine("Invalid entry - you must enter a value")
response = console.readline()
'add the value to the array
Surnames(Count) = response
'Promt to enter the volunteering option
Console.WriteLine("Enter " & n & " for " & VolunteerTypes(n))
response = console.ReadLine()
'validate the data entered
'type Check - make sure that the value entered is a number
If Not isnumeric(response) then
Console.WriteLine("Invalid entry - you must enter a number")
response = console.ReadLine()
'Range check - make sure that the value entered is between 0 and 3
elseif cint(response) < 0 OR cint(response)>3 then
Console.WriteLine("Invalid entry - you must enter a number in the range of 0 to 3")
response = console.ReadLine()
'Promt to enter the start day
Console.WriteLine("please enter the start date in the format 'DD/MMM/YYYY' (e.g. 05/dec/2020)")
response = console.ReadLine()
'validate the date that has just been entered
if not response.length = 11 then
console.WriteLine("the date entered is not the right length. Correctly formatted dates will have 11 characters")
response = console.ReadLine()
elseif not (response.Substring(2,1) = "/" and response.Substring(6,1) = "/") then
console.WriteLine("the date entered is not the right format. The 3rd and 7th characters should be '/'")
response = console.ReadLine()
elseif not isDate(response) then
Console.WriteLine("the date entered is not a valid date")
response = console.ReadLine()
'Range check 1 - in the future
elseif cdate(response) > Today then
Console.writeline("This date is invalid - it is in the future")
response = console.ReadLine()
'Range check 2 - too far in the past
elseif dateadd("yyyy",-4,Today) > cdate(response) then
Console.WriteLine("The date entered is too far in the past. All dates shoulbe be within the last four year.")
response = console.ReadLine()
'add the value to the array
JoiningDates(Count) = cdate(response)
'Prompt to enter whether the member has paid
Console.WriteLine("add details for member number - y/n?")
response = console.ReadLine()
do while not(response = "y" OR response = "n")
console.WriteLine("Invalid entry - please enter only 'y' or 'n' ")
response = console.ReadLine()
'Check to see if we need to set MembersToAdd to false
Console.WriteLine("add details for member number - y/n?")
response = console.ReadLine()
do while not(response = "y" OR response = "n")
console.WriteLine("Invalid entry - please enter only 'y' or 'n' ")
response = console.ReadLine()
Console.WriteLine("please enter your required option: ")
Console.WriteLine("================================== ")
Console.WriteLine("Enter 1 to list all member who have chosen to be volunteers, ")
Console.WriteLine("Enter 2 to list all volunteers who would like to work at the pier entrance gate")
Console.WriteLine("Enter 3 to list all volunteers who would like to work in the gift shop")
Console.WriteLine("Enter 4 to list all volunteers who would like to help with painting and decorating tasks. ")
Console.WriteLine("Enter 5 to list all members whose membership has expired")
Console.WriteLine("Enter 6 to list all members who have not yet paid their $75 fee.")
Console.WriteLine("Enter 0 to exit this program.")
'prompt for the response - a number in the range of 0 to 6
response = console.ReadLine()
'validate the data entered
'type Check - make sure that the value entered is a number
If Not isnumeric(response) then
Console.WriteLine("Invalid entry - you must enter a number")
response = console.ReadLine()
'Range check - make sure that the value entered is between 0 and 6
elseif cint(response) < 0 OR cint(response)> 6 then
Console.WriteLine("Invalid entry - you must enter a number in the range of 0 to 6")
response = console.ReadLine()
else if response = "1" then
console.WriteLine("All volunteers: ")
elseif response = "2" then
console.WriteLine("All pier entrance gate volnteers: ")
elseif response = "3" then
Console.WriteLine("All gift shop volunteers: ")
elseif response = "4" then
Console.WriteLine("All volunteers for painting and decorating: ")
elseif response = "5" then
Console.WriteLine("All members whose membership has expired: ")
elseif response = "6" then
Console.WriteLine("All members who have not paid their $75 fee: ")
if response <> "0" then '(0 means exit the loop
do while arrayIndex <= FirstNames.Length -1
if FirstNames(arrayIndex) <> "" then
'Display the first name and surname of all volunteers
'(i.e. anyone without a corresponding 0 in the VolunteerChoices array)
if not VolunteerChoices(arrayIndex) = 0 then
Console.WriteLine(FirstNames(arrayIndex) & " " & Surnames(arrayIndex) )
elseif CInt(response) > 1 AND CInt(response) < 5 then
'display the first name and surname of specific volunteers
'they will have (CInt(response) - 1) in the corresponding position in the Volunteering choices array
if VolunteerChoices(arrayIndex) = CInt(response) - 1 then
console.WriteLine(FirstNames(arrayIndex) & " " & Surnames(arrayIndex))
elseif response = "5" then
'list everyone whose joining date is more than one year old
'i.e. where DateAdd("yyyy", 1, JoiningDates(arrayIndex)) < Today
if DateAdd("yyyy" , 1, JoiningDates(arrayIndex)) < Today
console.WriteLine(FirstNames(arrayIndex) & " " & Surnames(arrayIndex))
elseif response = "6" then
'list everyone with the value False in the FeedPaid Array
if not FeePaid(arrayIndex) then
console.WriteLine(FirstNames(arrayIndex) & " " & Surnames(arrayIndex))
arrayIndex = arrayIndex + 1
'we are dealing with sponser details
Do while DataToAdd AND Count < 100
'loop until the sponser is happy with the data
do while not inputConfirmed
'prompt to enter the first name
console.WriteLine("please enter the first name of the sponser: ")
response = console.ReadLine()
'validate the entry with a presence check
Console.WriteLine("Invalid entry - you must enter a value")
response = console.ReadLine()
'set up the value of tmpFirstName to the value of response
'prompt to enter the surname
console.WriteLine("please enter the surname of the sponser: ")
response = console.ReadLine()
'validate the entry with a presence check
Console.WriteLine("Invalid entry - you must enter a value")
response = console.ReadLine()
'set up the value of tmpsurName to the value of response
'Prompt to enter the message
Console.WriteLine("please enter the message (max 200 characters): ")
response = console.ReadLine()
'Validate the entry with a presence check and a length check
Console.WriteLine("invalid entry - you must enter a value")
response = console.ReadLine()
elseif response.length > 200 then
Console.WriteLine("Invalid entry - your message is too long")
response = console.ReadLine()
'set the value of tmpMessage to the value of response
'allow the sponser to confirm their details
Console.WriteLine("Please confirm your details as follows: ")
Console.WriteLine("First Name: " & tmpFirstName)
Console.WriteLine("Surname: " & tmpSurname)
Console.WriteLine("Message: " & tmpMessage)
Console.WriteLine("Is this all correct - y/n")
response = console.ReadLine()
Do while not(response = "y" OR response= "n")
Console.WriteLine("Invalid entry - please enter only 'y' or 'n'")
response = console.ReadLine()
'Populate the arrays with the confirmed details
SponsorFirstNames(Count) = tmpFirstName
SponsorSurname(Count) = tmpSurname
PlaqueMessages(Count) = tmpMessage
'Confirm whether the sponser would like to pay now
Console.WriteLine("is the sponser going to pay now? - y/n")
response = console.ReadLine()
do while not(response = "y" OR response = "n")
Console.WriteLine("Invalid entry - please enter only 'y' or 'n' ")
response = console.ReadLine()
'update the Sonsorfeepaid array
SponsorFeePaid(count) = true
SponsorFeePaid(count) = false
'Add another sponser or quit
'confirm whether the sponser would like to pay now
Console.WriteLine("would you like to add more sponsers? - y/n")
response = console.ReadLine()
Do while not(response = "y" OR response = "n")
response = console.ReadLine()
'update the sponserFeedPaid array