16.1 notes

advertisement
Discrete II - Ch16 Bar and Zip Codes Notes
Name:___________________________
Date:_________
Objectives: The student will be able to understand the purpose of a check digit, determine a check digit or the validity of
a code for various checks and codes, convert a given ZIP code to its corresponding bar code, and vice versa., convert a
given UPC number to its corresponding bar code, and vice versa., given an identification number and the scheme, use it
to decipher the information such as birthdate and sex, encode a surname using the Soundex Coding System.
Check Digits: For Money orders, airline tickets, UPC, Zip, Bar, ISBN, and EAN, many frequently use types
of error-detecting code for identification numbers include an extra digit (usually the last digit) called a check digit.
There are a variety of ways that check digits are determined and verified.
A) USPS Money orders: the check digit (the last digit) is the remainder you get when you divide the sum
of the other digits by 9.
Example 1: Verify the check digit.
Example 2: USPS MO#: 6313592158_ ; find the missing CD
Example 3: USPS MO#: 631928_7342 ; find the missing digit
Example 4: USPS MO#: 341001_3914 ; find the missing digit
Example 5: USPS MO#: 62187850923; would the following errors be detected?
a)
3 instead of 8: 62187350923
b) 0 instead of 9: 62187850023
c)
12 instead of 21: 61287850923
B) American express and Visa traveler checks the check digit (the last digit) ensures you get a remainder
of zero when you divide the sum of all digits (including CD) by 9.
Example: Amex TC#: 18765490_ ; find the CD
Example: Amex TC#: 14565401_ ; find the CD
C) Some mail (UPS), airline txts and car rental services (Avis/ National/ Hertz) the check digit is
the remainder when you divide the number by 7.
Example: airline ticket#: 541207_ ; find the CD
Example: airline ticket#: 540047_ ; find the CD
Example: Would the error of switching the first 2 digits be caught?
4500474
Practice:
1. Determine the check digit for the following:
a) Money order: 4117321807 _
b) Money Order: 2001700765_
c) UPS ID#: 873345672_
d) airline ticket: 3086042205_
e) Avis rental car number: 6700098_
f) Amex travelers’ check#: 17650902_
2. What is the missing digit?
a) USPS money order #: 759_8164036
b) USPS money order #: 1_0023722462
c) Amex Travelers ck: 2_345098
d) Visa travelers’ ck: _21495003
3. Are the following numbers legitimate identification numbers?
(a) money order: 20935422030
b) money order: 74389235310
c) Amex Traveler Check: 2093502276
d) airline ticket: 105408970
e) Avis car rental: 3950047
f) Avis car rental: 1223795
D) The Universal Product Code (UPC) is a twelve-digit code, including a check digit at the end. By adding the digits
and multiplying by their weight (alternately 1 for even positions, 3 for odd positions including the check digit), the sum
must be a number ending in 0.
The number 0 38000 00127 7 is found on the bottom of a box of cornflakes




The first digit identifies a broad category of goods.
The next five digits identify the manufacturer.
The next five digits identify the product.
The last is a check digit.
Ex: The number 0 38000 00127 7 is found on the bottom of a box of cornflakes. Is it valid?
Ex: 0 58000 00 127 7 Is this UPC code valid?
Ex: Find the missing CD: UPC#: 3 61324 39012 _
Practice:
1. Determine the check digit for UPC 0-14300-25433-_
2. UPC for Welch’s fruit snack is 0 34856 00175 1 verify that it is valid.
3. a digit is incorrect for Welch’s fruit snack UPC#: 0 34876 00175 1 ; determine if the UPC check digit detects the
error.
4. 2 digits were transposed for Welch’s snack UPC#: 0 34865 00175 1 ; determine if the UPC check digit detects the
error.
5.
Is this a valid U.S. Postal Service money order number 74389235311 ?
6. Is this a valid Avis rental car number 3950040 ?
7.
Is this a valid UPC code 5-32500-65590-6?
E) The system used for credit cards (also known as Codabar Scheme)is a variation of UPC using a similar sum
with weights 2 (odd positions) and 1 (even positions). To this sum, you add the number of digits in odd positions that
exceed 4; the resulting number must end in 0 to be a valid code. The credit card number - 15 digits plus a check digit
Ex: Find the check digit for VISA #: 3125 6001 9643 001_
Ex: Find the check digit for Mastercard#: 4128 0012 3456 789_
Ex: Explain why the fictitious credit card number 4019 2783 1111 2322 a not a valid number.
F) Banks use weights of 7, 3, 9 respectively. Add up numbers with the weights, CD is last digit.
0710 Bank’s Federal Reserve District, office, and state or special collection arrangement
0001 Bank’s ID number
3 Check digit (error detection)
22 633 78 Checking account number
0134 Customer’s check number
Ex Verify the check number above: 071000013
Ex: Find the missing CD: 12903310_
Practice:
1. Determine the check digit that should be appended to the bank routing number 01500085_
2.
A suspicious check has routing number 198102957. Is the routing number valid?
3.
Determine the check digit for the credit card number 3001 2560 0196 431_
4.
Determine whether the Master Card number 3541 0232 0033 2270 is valid.
G) ISBN
Another important and effective error-detecting code is the International Standard Book Number
(ISBN). There are two types of ISBNs. The older one is a 10-digit code. The newer one is 13 digit.
10 digit Rules
10a1 + 9a2 + 8a3 + 7a4 + 6a5 + 5a6 + 4a7 + 3a8 + 2a9 + a10 is evenly divisible by 11.
Examples
1. Explain why the 10-digit ISBN of this classes book 1-4292-0900-3 is valid.
2. Find the missing CD:
1-4292-1507-_
3. Find the missing CD: 1-1234-1232-_
13-digit code Rules.
• The prefix (first 3 digits )is either 978 or 979.
• uses weights of 1 and 3. and ends in zero
Examples
1. Explain why the ISBN-13 of this classes book 978 1-4292-0900-7 is valid.
2. What would the check digit be on a 13-digit ISBN 978-1-1234-5678-_ in order for it to be valid?
3. What would the check digit be on a 13-digit ISBN 979-2-1324-0200-_ in order for it to be valid?
Practice:
1. Determine the check digit that should be appended to the ISBN number:
0-1234-0055- _
2. Is the ISBN number 0-8003-1212-7 legitimate?
3. Suppose that the ISBN 0-1750-3549-0 is incorrectly reported as 0-1750-3540-0. Is this error detected by the ISBN
check digit scheme?
4. Determine the check digit that should be appended to the ISBN number:
5. Is the ISBN number 979 0-8003-1212-7 legitimate?
978 0-1234-0055- _
Discrete II - Ch16 Bar and Zip Codes Notes Part 2
Name:___________________________
Date:_________
A) Zip Codes - The ZIP code is a U. S. Postal Service ID that encodes geographical information about each post
office. ZIP + 4 code is a further refinement of the ZIP code, capable of identifying small groups of mailboxes, like a
floor of a building, within a given postal zone.
Ex: 08873
A ZIP + 4 number is made up of 9 digits and one check digit. Including a check digit at the end, the sum of the ZIP + 4
digits must be a number ending in 0.
Ex: 55812-1234 9
Practice:
1. Determine the check digit that should be appended to the zip code
(a) 32398-4584
(b) 40823-7758
(c) 88923-5522
(d) 97779-7624
(e) 33017-3417
(f) 80999-5445
2. Are the following numbers legitimate zip code numbers?
(a) 20935-0227 0
(b) 55004-7622 9
B) Bar Codes
Bar codes use light spaces and dark bars to represent a
two-symbol binary code that is easily scanned
optically and decoded by a computer.
ZIP code bar codes use the Postnet code. Each digit is
represented by a group of five dark bars, two
long and three short. At the beginning and end there are
two long bars, which are called guard bars.
The following are the bar patterns.
(c) 80765-9001 6
d)
Question 1
Render a drawing of what the bar code would look like for the following postcard, including the
check digit for the ZIP+4 number. What would the check digit be for the postcard?
2. Convert the following to Postnet Codes
(a) 60510-2238
(b) 80765-9001
C) Encoding Personal Data
Personal data such as your name, birthdate, or sex can be encoded different ways. One way to encode a surname (last
name) is the Soundex Coding System. Every soundex code consists of a letter and 3 numbers, such as D-543. The
procedure is as follows.
1. Delete all occurrences of h and w.
2. Assign numbers to the remaining letters as follows:
a, e, i, o, u, y → 0
b, f, p, v → 1
c, g, j, k, q, s, x, z → 2;
l→4
m, n → 5
r→6
3. If two or more letters with the same numeric value are adjacent, omit all but the first.
4. Delete the first character of the original name if still present.
5. Delete all occurrences of a, e, i, o, u, and y.
6. Retain only the first three digits corresponding to the remaining letters; append trailing
0’s if fewer than three letters remain; precede the three digits obtained in step 6 with the
first letter of the surname.
Example
Encode the surname Adams using the Soundex Coding System.
d, t →3
Sampson
Practice:
Word
Washington
Schworer
Hochwald
Soundex
Word
Soundex
Pfister
Wu
Jackson
DeSmet
Tymczak
Ashcraft
Gutierrez
Lee
D) Driver’s licenses contain encoded information. For example, Florida and Illinois diver’s licenses use an encoding
system that considers both the date of birth and the sex of the resident.
• Florida: A five-digit number contains the information for the resident. The first two digits are the birth year (without
the 19), followed by a dash. Each day of the year is assigned a three-digit number with 001 representing January 1. Each
month is assigned 40 days. Added to this number is 500 if the resident is female.
• Illinois: A five-digit number contains the information for the resident. The first two digits
(separated by a dash) are the birth year (without the 19). Each day of the year is assigned a three-digit number with 001
representing January 1. Each month is assigned 31 days. Added to this number is 600 if the resident is female.
Practice
1. What would be the five-digit number assigned to a female driver in the states of Florida and Illinois born on July 27,
1966?
2.
53-640 identifies a Florida driver of which sex and birth date?
3. 5-3640 identifies an Illinois driver of which sex and birth date?
Download