This next problem is going to deal with checking if someone inputs a string with a few requirements. Imagine you are prompted to input a password, but the password needs to include uppercase letters and a number. In order to do this, you must look at each char in the string and use Booleans to indicate crtain criteria are met. Since there are 3 criteria, you should have 3 Boolean variables. The rules for the password are: Must contain at least 8 chars • Must contain 1 uppercase letter Must contain 1 digit There are no restrictions involving lowercase letters or special chars When considering where to use Booleans, think of it as a flag", for each criteria. If you meet the length requirement, then the flag would change from FALSE to TRUE. Once all the flags are true, you will have a valid password. Tip: The ASCII table can be used to determine the numeric value of a particular char. You may want to create ranges of these numerical values for each criteria.
This next problem is going to deal with checking if someone inputs a string with a few requirements. Imagine you are prompted to input a password, but the password needs to include uppercase letters and a number. In order to do this, you must look at each char in the string and use Booleans to indicate crtain criteria are met. Since there are 3 criteria, you should have 3 Boolean variables. The rules for the password are: Must contain at least 8 chars • Must contain 1 uppercase letter Must contain 1 digit There are no restrictions involving lowercase letters or special chars When considering where to use Booleans, think of it as a flag", for each criteria. If you meet the length requirement, then the flag would change from FALSE to TRUE. Once all the flags are true, you will have a valid password. Tip: The ASCII table can be used to determine the numeric value of a particular char. You may want to create ranges of these numerical values for each criteria.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
language is c++

Transcribed Image Text:Lab12B: Password
This next problem is going to deal with checking if someone inputs a string with a few requirements.
Imagine you are prompted to input a password, but the password needs to include uppercase letters
and a number. In order to do this, you must look at each char in the string and use Booleans to indicate
certain criteria are met. Since there are 3 criteria, you should have 3 Boolean variables.
The rules for the password are:
• Must contain at least 8 chars
• Must contain 1 uppercase letter
• Must contain 1 digit
• There are no restrictions involving lowercase letters or special chars
When considering where to use Booleans, think of it as a "flag", for each criteria. If you meet the
length requirement, then the flag would change from FALSE to TRUE. Once all the flags are true, you
will have a valid password.
Tip: The ASCII table can be used to determine the numeric value of a particular char. You may want
to create ranges of these numerical values for each criteria.
Sample output #1:
Enter a password: passwordl
Invalid password
Program Ends
Sample output #2:
Enter a password: P4ssw3rd
Valid password
Program Ends
Sample output #3:
Enter a password: Pas1
Invalid password
Program Ends
Sample output #4:
Enter a password: PASSword
Invalid password
Program Ends
Sample output #5:
Enter a password: Pas!w3rd
Valid password
Program Ends
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 6 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY