Username: mary Type your current password: secret Username or password incorrect Try again. Username: alpha Type your current password: supersecret Username or password incorrect. Try again. Username: angela Type your current password: beta1 Username or password incorrect. Too many attempts. e are two examples of initial failed logins followed by a successful login: Username: alpha Type your current password: beta1 Username or password incorrect Try again. Username: alpha Type your current password: alpha1 Login successful. Username: alpha Type your current password: beta Username or password incorrect. Try again. Username: mary Type your current password: beta1 Username or password incorrect. Try again. Username: gamma Type your current password: gamma1 Login successful. rder to make this happen, ask for the username and password inside a while I e tricky to print out the right messages for different situations. ead of checking all the username-password combinations in the main method eptable user-password combinations, userPasswordMatch should return true ecessary tests, i.e. if a test is successful, don't continue to do more tests.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter9: Sequential Access Files And Menus
Section: Chapter Questions
Problem 11E
icon
Related questions
Question
Here is an example of what your program should output when there are three unsuccessful login attempts:
Username: mary
Type your current password: secret
Username or password incorrect.
Try again.
Username: alpha
Type your current password: supersecret
Username or password incorrect.
Try again.
Username: angela
Type your current password: beta1
Username or password incorrect.
Too many attempts.
Here are two examples of initial failed logins followed by a successful login:
Username: alpha
Type your current password: beta1
Username or password incorrect.
Try again.
Username: alpha
Type your current password: alpha1
Login successful.
Username: alpha
Type your current password: beta
Username or password incorrect.
Try again.
Username: mary
Type your current password: beta1
Username or password incorrect.
Try again.
Username: gamma
Type your current password: gamma1
Login successful.
In order to make this happen, ask for the username and password inside while loop in the main method. Do the checks for a correct combination, and remain in the loop as long as the combinations are not correct - but only for three iterations. Use the increment operator to count the number of attempts. It is going
to be tricky to print out the right messages for different situations.
Instead of checking all the username-password combinations in the main method, write a method called userPassword Match that takes a username and password as input. Send the username and password values from the main method to userPassword Match. If the combination matches one of the four
acceptable user-password combinations, userPassword Match should return true, otherwise it should return false. (A reason to do this is to make it possible to add new users without touching the main method.) (Hint: You can use the return value of userPasswordMatch to control the while loop.) Don't do
unnecessary tests, i.e. if a test is successful, don't continue to do more tests.
Transcribed Image Text:Here is an example of what your program should output when there are three unsuccessful login attempts: Username: mary Type your current password: secret Username or password incorrect. Try again. Username: alpha Type your current password: supersecret Username or password incorrect. Try again. Username: angela Type your current password: beta1 Username or password incorrect. Too many attempts. Here are two examples of initial failed logins followed by a successful login: Username: alpha Type your current password: beta1 Username or password incorrect. Try again. Username: alpha Type your current password: alpha1 Login successful. Username: alpha Type your current password: beta Username or password incorrect. Try again. Username: mary Type your current password: beta1 Username or password incorrect. Try again. Username: gamma Type your current password: gamma1 Login successful. In order to make this happen, ask for the username and password inside while loop in the main method. Do the checks for a correct combination, and remain in the loop as long as the combinations are not correct - but only for three iterations. Use the increment operator to count the number of attempts. It is going to be tricky to print out the right messages for different situations. Instead of checking all the username-password combinations in the main method, write a method called userPassword Match that takes a username and password as input. Send the username and password values from the main method to userPassword Match. If the combination matches one of the four acceptable user-password combinations, userPassword Match should return true, otherwise it should return false. (A reason to do this is to make it possible to add new users without touching the main method.) (Hint: You can use the return value of userPasswordMatch to control the while loop.) Don't do unnecessary tests, i.e. if a test is successful, don't continue to do more tests.
• Use a while loop
• Use multiple loop controlling conditions
• Use a boolean method
• Use the increment operator
• Extra credit: Reuse earlier code and call two methods from main
Details:
This assignment will be completed using the Eclipse IDE. Cut and paste your code from Eclipse into the Assignment text window.
This is another password program. In this case, your code is simply going to ask for a username and password, and then check the input against four users. The program will give the user three tries to input the correct username-password combination.
There will be four acceptable user-password combinations:
• alpha-alpha1
• beta-beta1
• gamma-gamma1
• delta - delta1
If the user types in one of the correct username-password combinations, then the program will output: "Login successful." Here are a couple of example runs (but your code needs to work for all four user-password combinations):
Username: beta
Type your current password: beta1
Login successful.
Username: delta
Type your current password: delta1
Login successful.
If the user types the wrong username-password combination, then the program will output "Username or password incorrect" and give them another chance. Your program should give them three chances. The first two times the program will also output "Try again," but on the third unsuccessful try it will output "Too
many attempts" and end.
Here is an example of what your program should output when there are three unsuccessful login attempts:
Username: mary
Type your current password: secret
Username or password incorrect.
Try again.
Username: alpha
Type your current password: supersecret
Username or password incorrect.
Try again.
Username: angela
Type your current password: beta1
Username or password incorrect.
Too many attempts.
Here are two examples of initial failed logins followed by a successful login:
Transcribed Image Text:• Use a while loop • Use multiple loop controlling conditions • Use a boolean method • Use the increment operator • Extra credit: Reuse earlier code and call two methods from main Details: This assignment will be completed using the Eclipse IDE. Cut and paste your code from Eclipse into the Assignment text window. This is another password program. In this case, your code is simply going to ask for a username and password, and then check the input against four users. The program will give the user three tries to input the correct username-password combination. There will be four acceptable user-password combinations: • alpha-alpha1 • beta-beta1 • gamma-gamma1 • delta - delta1 If the user types in one of the correct username-password combinations, then the program will output: "Login successful." Here are a couple of example runs (but your code needs to work for all four user-password combinations): Username: beta Type your current password: beta1 Login successful. Username: delta Type your current password: delta1 Login successful. If the user types the wrong username-password combination, then the program will output "Username or password incorrect" and give them another chance. Your program should give them three chances. The first two times the program will also output "Try again," but on the third unsuccessful try it will output "Too many attempts" and end. Here is an example of what your program should output when there are three unsuccessful login attempts: Username: mary Type your current password: secret Username or password incorrect. Try again. Username: alpha Type your current password: supersecret Username or password incorrect. Try again. Username: angela Type your current password: beta1 Username or password incorrect. Too many attempts. Here are two examples of initial failed logins followed by a successful login:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Network Security
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage