Question

In: Operations Management

1. Define a regular expression for validating each of the following: a. A U.S. zip code,...

1. Define a regular expression for validating each of the following:

a. A U.S. zip code, which must have five digits, followed by an optional hyphen and four digits.

b. A telephone number in the format (aaa) nnn-nnnn, where aaa represents the area code and the ns represent digits.

c. A date in the form of day-month-year, where the month is a three-letter code and the year is four digits. A hyphen must separate the day and month and year and month.

2. For the following codes, define the validation criteria (there may be multiple checks for each field) and the order in which you would test each of the conditions.

a. A credit card number entered on a Web form: The customer has selected the type of credit card from a drop-down list.

b. A part number in a hardware store: The part number is a complex code, where the first digit represents the department (such as housewares, automotive, and so on), and the number should be self-checking. There are seven different departments.

c. The date that a book was postmarked when returned to an online bookstore: A copy of the customer receipt must be included with the book. Returned books must be postmarked within 30 days of the purchase date.

d. A language spoken code used on a website: Hint: Search the Web for standard language codes.

e. The Canadian postal code: The format is X9X 9X9 (X is any letter, 9 is any number).

f. Airport codes: Such as LAX for Los Angeles or DUB for Dublin.

Solutions

Expert Solution

*****Please please please LIKE THIS ANSWER, so that I can get a small benefit, Please*****

Define a regular expression for validating each of the following:

a. A U.S. zip code, which must have five digits, followed by an optional hyphen and four digits.
b. A telephone number in the format (aaa) nnn-nnnn, where aaa represents the area code and the ns represent digits.
c. A date in the form of day-month-year, where the month is a three-letter code and the year is four digits. A hyphen must separate the day and month and year and month.

a. Regular Expression for US zip code, which has 5 digits followed by an optional hyphen and 4 digits, is as follows:-

b. Expression for a telephone number in the format (aaa) nnn-nnnn is a s follows:-

c. Expression for date in day-month-year format where the month is three letter code and year is four digits separated by hyphen is as follows:-

For the following codes, define the validation criteria (there may be multiple checks for each field) and the order in which you would test each of the conditions.

a. A credit card number entered on a Web form: The customer has selected the type of credit card from a drop-down list.
b. A part number in a hardware store: The part number is a complex code, where the first digit represents the department (such as housewares, automotive, and so on), and the number should be self-checking. There are seven different departments.
c. The date that a book was postmarked when returned to an online bookstore: A copy of the customer receipt must be included with the book. Returned books must be postmarked within 30 days of the purchase date.
d. A language spoken code used on a website: Hint: Search the Web for standard language codes.
e. The Canadian postal code: The format is X9X 9X9 (X is any letter, 9 is any number).
f. Airport codes: Such as LAX for Los Angeles or DUB for Dublin.

a. The validation criteria for a credit card number entered on a web form are by using Luhn formula. The first check when a credit card number is entered is the length of the number; next test is to match the credit card company and bank to verify that it is actually a card issued by that company.

b. Validation criteria for a part number in a hardware store can be setting up self-validating codes (Check digits). The Check digits helps to detect single digit miss key or transposition errors.

c. Store the date as part of code used to identify the book. When the book will be returned the range validity test can be done to ensure that the book is returned within the given time range.

d. Validation for a language spoken code used on a website can be validated by comparing them to document type definition. It will check to see whether the format of the document is valid.

e. Validation criteria for Canadian postal code of format X9X9X9 can best test for class or composition which checks to see that the data fields are compose of letters or digits. Also test for valid values can be done which checks input for invalid works if there are only a few valid values.

f. Validation criteria for Airport codes can be test for class or composition using a composition test the program should not accept any flight code that includes both letters and numbers GUI screens will help in these kinds of entries without error.

*****Please please please LIKE THIS ANSWER, so that I can get a small benefit, Please*****


Related Solutions

Define a regular expression in JAVA for the following An "Ent" is an at sign '@',...
Define a regular expression in JAVA for the following An "Ent" is an at sign '@', followed by one or more decimal digits '0' through '9' or uppercase letters 'R' through 'W', followed by an octothorpe sign '#'
submit a regular expression that will identify each of the following patterns. 1 - a US...
submit a regular expression that will identify each of the following patterns. 1 - a US telephone number that conforms to the following pattern 111.222.3456 2 - a US social security number that fits the following pattern 111-22-3456 3 - an American Express credit card number that fits the following format:       4 digits followed by a space followed by 6 digits followed by a space followed by 5 digits False positives are allowed in each case, so all you need...
1. What is a regular expression? Write a regular expression that will detect “College” and “collegE”....
1. What is a regular expression? Write a regular expression that will detect “College” and “collegE”. 2. What is degree centrality? Create a graph of 4 vertices and compute the degree centrality of the vertices. 3. Compute internal and external community densities for a graph containing 6 nodes. You can create any graph of 6 nodes with at least 4 edges.
Regular Expressions Assignment Write a regular expression for each of the following. Can you show output...
Regular Expressions Assignment Write a regular expression for each of the following. Can you show output please. A blank line (may contain spaces) Postal abbreviation (2 letters) for State followed by a space and then the 5-digit zip code A KU student username (Ex. lpork247) A “valid” email address (also explain how you defined “valid”) A SSN pattern (ddd-dd-dddd)
Unix / Linux 16. Regular Expression: Given the following regular expression, provide a description of the...
Unix / Linux 16. Regular Expression: Given the following regular expression, provide a description of the intended match. ^[^A-Z] 17. Regular Expression: Given the following regular expression, provide a description of the intended match. [^^!] 18. Regular Expression: Given the following regular expression, provide a description of the intended match. ^.\{72\}$ 19. Regular Expression: Given the following regular expression, provide a description of the intended match. [A-Za-z0-9] 20. Regular Expression: Given the following regular expression, provide a description of the...
Formal Languages Give a regular expression for each of the following languages: L2a = {w ?...
Formal Languages Give a regular expression for each of the following languages: L2a = {w ? {0,1}* | w corresponds to the binary encoding of non-negative integers that are evenly divisible by 4 L2b = {w ? {a,b}* | w contains at least one 'a' and exactly two b's} L2c = {w ? {0, 1, 2}* | w starts with a 2, ends with a 1 and contains an even number of 0's}.
Consider the following regular expression meta operators: ( ) [ ] { } . * +...
Consider the following regular expression meta operators: ( ) [ ] { } . * + ? ^ $ | \ For each of the following, give one example of strings which the regular expression would match. Describe (colloquially, in a manner that a non-technical person would understand) the set of strings that the pattern is designed to match. Each regular expression is enclosed in the pair of '/' characters below. [2 marks each] (a) /^[a-z][0-9]*\.$/ (b) /([0-9]+)\s\w+\s\1/
If you would define a rule for creating a variable in C using regular expression, how...
If you would define a rule for creating a variable in C using regular expression, how would you write it? If you need to skip statements in for or while loops and go to the next iteration, what statement will you use? In respect to users and processes, how would you define Linux OS?
create a regular expression in Java that defines the following. A "Stir" is a right brace...
create a regular expression in Java that defines the following. A "Stir" is a right brace '}' followed by zero or more lowercase letters 'a' through 'z' and decimal digits '0' through '9', followed by a left parenthesis '('.
1-What is the expression for the thin lens equation? Define all the terms in the expression....
1-What is the expression for the thin lens equation? Define all the terms in the expression. 2-Describe the three properties that determine the focal length of a lens. 3-Define the following: i. Converging lens______ ii. Diverging lens_______ iii. Focal length___________ iv. Focalpoint____________ v. Object distance_______ vi. Imagedistance___ vii. Real image___ viii. Virtual image
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT