Homework 12, due Friday, February 18, 2011

The Postnet bar code is a barcode the postal service puts on mail to make it possible for zip codes to be read by a machine. The bar code uses two kinds of bars, tall ones and short ones. Here's what a postnet bar code looks like:

|.|.|...||..|..||..|....|||.|...|..|||....||....|.||

The first and last bars are always tall bars, called framing bars. They help the laser reader line up the bar code. If we take the framing bars away, what's left comes in groups of 5 bars, always 2 tall ones and 3 short ones. Here are the groups of 5 for the bar code above:

.|.|.
..||.
.|..|
|..|.
...||
|.|..
.|..|
||...
.||..
..|.|
Each group of 5 bars represents a single digit, as follows:

1: ...||
2: ..|.|
3: ..||.
4: .|..|
5: .|.|.
6: .||..
7: |...|
8: |..|.
9: |.|..
0: ||...

Most zip codes are 9 digits long, called zip + 4. The math department's zip + 4 is 68588-0323. Sometimes the zip code has two extra digits, for 11 all together. These last two digits are called the delivery point code. If your zip + 4 code is 68154-0130 and your house number is 812, then your 11 digit zip + 4 plus delivery point code is 68154-0130-12. The delivery point code is just the last two digits of your house number. This allows mail to be sorted by machine so that the mail is in the same order as the houses on the street. Postnet codes also always have one extra digit, called a check digit, so the bar codes encode either a string of 10 digits (the 9 digits of the zip + 4 plus a check digit) or 12 digits (the 11 digits of the zip + 4 plus the 2 digit delivery point code plus a check digit). We'll talk about check digits in class.

Homework: Decode the first 7 postnet codes on the worksheet here.