Get Best Penn Foster 037093


Get Best Penn Foster 037093


Data Types and Application
In the graded project for Lesson 1, you created a login form
using a Windows Forms Application project in Visual Studio.
In this project, you’ll implement the login process. The login
process will use
■ A Boolean value to indicate success
■ Two parallel arrays for usernames and passwords (See
pages 492–495 in your textbook on using parallel
■ Three procedures that contain conditional and iterative
Note: The output of this project will be used in the graded
project for Lesson 3.
1. In Visual Studio, load the GroceryApp project that you
completed in Lesson 1.
a. Right-click the project name in Solution Explorer or
choose the Add New Item… option in the Project
b. In the Add New Item dialog, choose Module. Type
the name Main. vb in the Name text box at the
3. Click the Add button (Figure 26).
In the Main module, you’ll perform the following actions:
a. Declare a Boolean variable named blnLoggedIn.
b. Declare two String arrays named usernames and
c. Declare a subroutine named Login that accepts two
String parameters named username and password.
4. Declare two functions named VerifyUsername and
VerifyPassword. The VerifyUsername function should
accept a String parameter named username and return
a Boolean value. The VerifyPassword function should
accept a String parameter named password and return a
Boolean value.
When this task is completed, the source code editor
should contain what’s shown in Figure 27.
Use the values Admin, Clerk, and Manager as items in
the are usernames array. Use the assignment operator
and curly braces to modify the declaration as follows:
Dim are usernames() As String = {ªAdminº, ªClerkº,
Use the values [email protected], pa$$word, and passw0rd as
items in the RAR passwords array. Use the assignment
operator and curly braces to modify the declaration as
Dim arrPasswords() As String = {ª[email protected]º, ªpa$$wordº,
In the Login subroutine, make sure that the username
and password arguments are valid and match.
5. Set the blnLoggedIn variable to False. This is to ensure
that previous attempts are overwritten.

6. Use an If…Else statement. Using the logical operator
And, combine the return value from calling the
VerifyUsername and VerifyPassword functions.
7. If the username and password arguments are valid, then
make sure the value in the usernames array matches
the value in the RAR passwords array.
8. If the correct password is specified for the username,
then set the blnLoggedIn variable to the value True.
If not, then display an error message box.
When the task is complete, the Login function should be
defined as follows:
Sub Login(ByVal username As String, ByVal password As
blnLoggedIn = False
If VerifyUsername(username) And VerifyPassword(password)
‘Find index for username
Dim user index As Integer
For loopIndex = 0 To are usernames.Length. 1
If are usernames(loop index) = username Then
use index = loop index
Exit For
End If
‘Check for password match
If are passwords(userIndex) = password Then
blnLoggedIn = True
MessageBox.Show(“Incorrect password.”)
End If
MessageBox.Show(“Incorrect password.”)
End If
End Sub
9. Using what you know about search arrays, implement
the VerifyUsername and VerifyPassword functions.
They should return true if the username or password is
found in the are usernames or are passwords array,
10. Save your work.
11. In the LoginForm.vb, find the subroutine
12. You can either right-click on the LoginForm.vb file in
Solution Explorer and choose the View Code option in
the context menu or double-click on the LoginForm.vb
file in Solution Explorer and double-click on the Login
button on the form.
13. Navigate to the btnLogin_Click subroutine.
14. Modify the contents of the btnLogin_Click button.
a. Call the Login subroutine in the Main module.
b. Use the blnLoggedIn variable to determine whether to
display the message box.
The btnLogin_Click subroutine should resemble the
Main.Login(text username.Text, txtPassword.Text)
If Main.blnLoggedIn Then
MessageBox.Show(“Thank you for logging in, “ & _
text username.Text, “Logged In.”)
End If
15. You should get an error message using the blnLoggedIn
variable. Later in your course, there will be a discussion
on access modifiers, but for right now, just know that
you need to change the Dim keyword to Friend.
Open the Main. vb file.
16. Modify the blnLoggedIn declaration as follows:
Friend blnLoggedIn As Boolean
Save your work and debug the application. See what
happens when you type in an incorrect username and
17. Make sure the application works as intended.
To submit your project, you must provide the following two
■ Main. vb
■ LoginForm.vb
To find these files, you should go to the directory where you
saved the GroceryApp project. To determine this path, click
on GroceryApp in the Solution Explorer panel. Copy the
value for the Project Folder property in the Properties
panel. In Windows Explorer, paste the file path and hit the
Enter key. Copy both the Main. vb and LoginForm.vb files to
your desktop or any other temporary location.
Use the following procedure to submit your project online:
1. Log in to view your student homepage and go to the
My Courses page.
2. Click on Take Exam next to the lesson you’re working on.
3. Attach your files as follows:
a. Click on the Browse box.
b. Locate the file you wish to attach.
c. Double-click on the file.
d. Click Upload File.
e. If you have more than one file to attach, repeat
steps a–d for each file.
4. Enter your e-mail address in the box provided.
(Note: Your e-mail address is required for online
5. If you wish to include comments about this project to
your instructor, enter your comments in the Message
6. Click on Submit Files.
Your project will be graded using the following guidelines.
■ The code contains the correct variables
and procedures. 160 points
■ The logic of the procedures is correct. 120 points
■ The Login button works as expected. 110 points
■ Both source code files are included. 110 points
TOTAL 100 points


Need to Buy Penn Foster?

Exams are an essential part of a student’s schooling. Without an exam, no student can improve through the ladder of success. However, university college students these days do now no longer have the time to be interested in their studies, cause they will be overwhelmed by the manner of the method of jobs that help the very schooling they need. In their time of need, Get Exam Done is proper right here to offer a hand of help. For university college students who are thinking, can I pay a person to take my exam, this is the area to get it from. We have been supporting university college students for over 2 years with their pay someone to take my exam troubles and characteristic completed over 5000+ exams everywhere in the states.

Scott Belmont from NYC, USA
Hired a tutor to take programming class and final exam
40 minutes ago
Ebony Nicole from Bronx, USA
Hired a tutor to take history and algebra final exams
2 hours ago
Randy Wells from Texas, USA
Hired an expert to take chemistry proctored exam
1 hour ago
Kurt LeBlanc from Iowa, USA
Hired an expert to take statistics online exam
1 hour ago