Penn Foster Graded Project 03784000 Data Types and Application Logic

$ 15

Penn Foster Graded Project 03784000 Data Types and Application Logic

OVERVIEW
You’re ready to add further functionality to the GroceryApp project. This project will assess your understanding of using variables, arrays, modules, and procedures. Make sure that you follow all directions completely and verify your results before submitting the project. Remember to include all required components in your solution.

YOUR PROJECT
In the grade 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.
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. If this is not available, then you will need to ask your instructor for the finished Lesson 1 project.
2. Add a new module to the project.
a. Right-click the project name in Solution Explorer and choose Add > Module… or choose the Add Module… option in the PROJECT menu.
b. Type the name Main.vb in the Name text box at the bottom (Figure 22).
c. Click the Add button.
3. In the Main module, you will 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.
d. 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 the code shown in Figure 23.
4. Save your work.
5. 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”}
6. 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” }
7. In the Login subroutine, make sure that the username and password arguments are valid and match.
a. Set the blnLoggedIn variable to False. This is to ensure that previous attempts are overwritten.
b. Use an If…Else statement. Using the logical operator And, combine the return value from calling the VerifyUsername and VerifyPassword functions.
c. If the username and password arguments are valid, then make sure the value in the arrUsernames array matches the value in the arrPasswords array.
d. 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.
e. When the task is complete, the Login function should be defined as follows:
Sub Login(username As String, password As String)
blnLoggedIn = False
If VerifyUsername(username) And VerifyPassword(password)
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
End If
Next
‘Check for password match
If arrPasswords (userIndex) = password Then
blnLoggedIn = True
Else
MessageBox.Show(“Incorrect password.”)
End If
End If
End Sub
8. 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.
9. Save your work.
10. In the LoginForm.vb, find the subroutine btnLogin_Click.
a. 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 doubleclick on the Login button on the form.
b. Navigate to the btnLogin_Click subroutine.
11. 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.
c. The btnLogin_Click subroutine should resemble the following:
You should get an error message using the blnLoggedIn variable. In the next lesson, you’ll be introduced to access modifiers, but for right now, just know that you need to change the Dim keyword to Friend.
12. Open the Main.vb file and modify the blnLoggedIn declaration as follows:
Friend blnLoggedIn As Boolean
13. Save your work and debug the application. See what happens when you type in an incorrect username andpassword.
14. Make sure the application works as intended.
Main.Login(txtUsername.Text , txtPassword.Text)
If Main.blnLoggedIn Then
MessageBox.Show(“Thank you for logging in, ” & txtUsername.Text , “Logged In. “)
Me.Close()
End If

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 directory where you saved the GroceryApp project. To open the project directory, right-click on GroceryApp in the Solution Explorer panel and choose the Open Folder in File Explorer option in the context menu (Figure 24).
Copy both the Main.vb and LoginForm.vb files to your desktop or any other temporary location.

Your project will be graded using the following guidelines:
The code contains the correct
variables and procedures 60 points
The logic of the procedures is correct 20 points
The Login button works as expected 10 points
Both source code files are included 10 points
TOTAL 100 points

82 in stock

SKU: PENN03784000 Category:

Description

Penn Foster Graded Project 03784000 Data Types and Application Logic

OVERVIEW
You’re ready to add further functionality to the GroceryApp project. This project will assess your understanding of using variables, arrays, modules, and procedures. Make sure that you follow all directions completely and verify your results before submitting the project. Remember to include all required components in your solution.

YOUR PROJECT
In the grade 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.
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. If this is not available, then you will need to ask your instructor for the finished Lesson 1 project.
2. Add a new module to the project.
a. Right-click the project name in Solution Explorer and choose Add > Module… or choose the Add Module… option in the PROJECT menu.
b. Type the name Main.vb in the Name text box at the bottom (Figure 22).
c. Click the Add button.
3. In the Main module, you will 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.
d. 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 the code shown in Figure 23.
4. Save your work.
5. 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”}
6. 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” }
7. In the Login subroutine, make sure that the username and password arguments are valid and match.
a. Set the blnLoggedIn variable to False. This is to ensure that previous attempts are overwritten.
b. Use an If…Else statement. Using the logical operator And, combine the return value from calling the VerifyUsername and VerifyPassword functions.
c. If the username and password arguments are valid, then make sure the value in the arrUsernames array matches the value in the arrPasswords array.
d. 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.
e. When the task is complete, the Login function should be defined as follows:
Sub Login(username As String, password As String)
blnLoggedIn = False
If VerifyUsername(username) And VerifyPassword(password)
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
End If
Next
‘Check for password match
If arrPasswords (userIndex) = password Then
blnLoggedIn = True
Else
MessageBox.Show(“Incorrect password.”)
End If
End If
End Sub
8. 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.
9. Save your work.
10. In the LoginForm.vb, find the subroutine btnLogin_Click.
a. 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 doubleclick on the Login button on the form.
b. Navigate to the btnLogin_Click subroutine.
11. 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.
c. The btnLogin_Click subroutine should resemble the following:
You should get an error message using the blnLoggedIn variable. In the next lesson, you’ll be introduced to access modifiers, but for right now, just know that you need to change the Dim keyword to Friend.
12. Open the Main.vb file and modify the blnLoggedIn declaration as follows:
Friend blnLoggedIn As Boolean
13. Save your work and debug the application. See what happens when you type in an incorrect username andpassword.
14. Make sure the application works as intended.
Main.Login(txtUsername.Text , txtPassword.Text)
If Main.blnLoggedIn Then
MessageBox.Show(“Thank you for logging in, ” & txtUsername.Text , “Logged In. “)
Me.Close()
End If

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 directory where you saved the GroceryApp project. To open the project directory, right-click on GroceryApp in the Solution Explorer panel and choose the Open Folder in File Explorer option in the context menu (Figure 24).
Copy both the Main.vb and LoginForm.vb files to your desktop or any other temporary location.

Your project will be graded using the following guidelines:
The code contains the correct
variables and procedures 60 points
The logic of the procedures is correct 20 points
The Login button works as expected 10 points
Both source code files are included 10 points
TOTAL 100 points

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.