Download Guided Penn Foster 037840

$3.99

Download Guided Penn Foster 037840

 

Data Types and Application
Logic
OVERVIEW
YOUR PROJECT
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
arrays.)
■ Three procedures that contain conditional and iterative
statements.
Note: The output of this project will be used in the graded
project for Lesson 3.
INSTRUCTIONS
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
menu.
b. In the Add New Item dialog, choose Module. Type
the name Main. vb in the Name text box at the
bottom.
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
passwords.
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º,
ªManagerº}
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
follows:
Dim arrPasswords() As String = {ª[email protected]º, ªpa$$wordº,
ªpassw0rdº}
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
String)
blnLoggedIn = False
If VerifyUsername(username) And VerifyPassword(password)
Then
‘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
Next
‘Check for password match
If are passwords(userIndex) = password Then
blnLoggedIn = True
Else
MessageBox.Show(“Incorrect password.”)
End If
Else
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,
respectively.
10. Save your work.
11. In the LoginForm.vb, find the subroutine
btnLogin_Click.
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
following:
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
password.
17. Make sure the application works as intended.
SUBMISSION GUIDELINES
To submit your project, you must provide the following two
files:
■ 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
submissions.)
5. If you wish to include comments about this project to
your instructor, enter your comments in the Message
box.
6. Click on Submit Files.
GRADING CRITERIA
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 Guide to Penn Foster?

Are you searching for online examination help? Our take my online take-examine experts will save you all the stress you’re taking to remedy exams online. Our exam helper will guide you with the most accurate solution in your online exam preparations. We endorse you are seeking a recommendation from our online exam helper to find out the right course for clearing your take-look. Our group has supplied online exam help to many university college students in well-known global places simply because the United States, Canada, Australia, and the United Kingdom, wherein university college students have received appropriate grades. So, what are you equipped for? Take this golden opportunity to excel on your take a look. Chat with us today! For custom, help email us at [email protected]wantonlineclasshelp.com or WhatsApp us at +1(657)366-7486

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