The following assignment incorporates the concepts from prior weeks (variables, if-else logic, loops, and arrays), along with this week's topic of file input/output process.
Create a Visual Logic program that will:
• Create an array of people's first names. Using a loop, read the names from a text (txt) file, and store each one into the array. The array should allow for a maximum of 100 entries. Continue to read in first names and store them into the array. The last entry in the text file, containing "LastOne," will indicate the end of the list of names.
• Prompt the user for a first name.
• Loop through the array to determine if the first name entered exists in the array. If a match is found, display a message that includes the name and a message indicating that there was a match found. If no match is found, display a message so indicating.
• Using a loop, continue to prompt the user for first names and determine if a match in the array is found. The loop should continue until the user indicates "stop" as the first name.
Resources/Tips:
• This program requires the use of nested loops. The outer loop will repeat, prompting the user for a first name until the user indicates to stop. The inner loop will search through the array for a match.
• Review the Sample Program #3 on pages 83-87 in A Guide to Working with Visual Logicsfor an example of using files.
• Have the txt files, your Visual Logic® program, the Visual Logic® exe file, and the VLSig file in the same folder
• Put quotes around each name in the text (txt) file.
Submit the following in a zip file, using the Assignment Files tab:
• Text (txt) file with names
• Visual Logic (As) file
SAMPLE PROGRAM #3: PARALLEL
ARRAYS (US ERNAM E AND PASSWORD)
In this section we examine a problem that involves maintaining two parallel arrays. The first array holds usemames and the second array holds passwords. The two arrays are separate but related, each having the same number of elements, and the values in one correspond to the values in the other. For example, the seventh element in the username array and the seventh element in the password array together form a valid username/password combination that would grant authentication to the system.
Write a program that reads 10 usemame and password pairs and stores those username and password values into parallel arrays. After the arrays have been loaded, the program should behave as a login screen, prompting for a usemame and a password. Based on the data entered for usemame and password, the program should respond appropriately with one of three output messages. If the username does not match one of the values in the usemame array, then the message should be "Usemame not found." If the username is found in the usemame array, but the password does not match the parallel value in the password array, then the message should be "Username and password do not match." If the username is found and the password matches the parallel value in the password array, the message should be "Access granted."