Tuesday, December 3, 2013

Penn Foster 037093 Data Types and Application Logic

Penn Foster 037093

Data Types and Application Logic

Click Below Link To Download

OVERVIEW
If you’ve read through selected sections of Chapter 3, 4, 6, 7, and 8 in your textbook and completed the related study guide material, you’re ready to add further functionality to the GroceryApp project. This project will assess your understand- ing of using variables, arrays, modules and procedures.
Make sure you follow all directions completely and verify your results before submitting the project. Remember to include all required components in your solution or you won’t receive full credit.

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.
2.Add a new module to the project.
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 arrUsernames and arrPasswords.
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 arrUsernames array. Use the assignment operator and curly braces 
to modify the declaration as follows:
Dim   arrUsernames()  As  String  =   {ªAdminº, ªClerkº,ªManagerº}
Use the values P@ssword, pa$$word, and passw0rd as items in the arrPasswords array. Use the assignment operator and curly 
braces to modify the declaration as follows:
Dim   arrPasswords()   As   String   =   {ªP@sswordº, ª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 arrUsernames array matches the value 
in the arrPasswords 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(pass- word) Then
‘Find index for username
Dim  userIndex  As  Integer
For  loopIndex  =  0  To  arrUsernames.Length 1 If arrUsernames(loopIndex)  =  username  Then
userIndex  =   loopIndex Exit  For
Else
End If Next
‘Check for password match
If arrPasswords(userIndex)  =  password  Then blnLoggedIn = True
Else
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 arrUsernames or arrPasswords 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(txtUsername.Text, txtPassword.Text) If Main.blnLoggedIn Then
MessageBox.Show(“Thank  you  for  logging  in, “  &  _ txtUsername.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.

Preview Solution:

Penn Foster 037093
Data Types and Application Logic - Main and LoginForm 
This tutorial was purchased time and rated A+ by students like you.
Posted on Feb 21, 2013 at 12:49:46PM

Price: $20
Special Price: $15
Email: syedjahangirb@gmail.com for downloading assignment
File in Solution:


2 comments: