Question: CS1514: Computer Science lI Problem 5 Instructor: Jawad Drissi POSTNET Bar Codes The bar codc on an cnvelope usod by the US Postal Scrvice represcnts
CS1514: Computer Science lI Problem 5 Instructor: Jawad Drissi POSTNET Bar Codes The bar codc on an cnvelope usod by the US Postal Scrvice represcnts a five (or more) digit zip code using a format called POSTNET (this format is being deprecated in favor of a new system, OneCode, in 2009). The bar code consists of long and short bars as shown below: lilulullluabll For this program we will represent the bar code as a string of digits. The digit I represents a long bar and the digit 0 represents a short bar. Therefore, the bar code above would be represented in our program as 110100101000101011000010011 The first and last digits of the bar code are always 1. Removing these leave 25 digits. If these 25 digits are split into groups of five digits each then we have: 10100 10100 01010 11000 01001 Next, consider each group of five digits. There will always be exactly two l's in each group of digits. Each digit stands for a number. From left to right the digits encode the values 7,4, 2,1 and 0. Multiply the corresponding value with the digit and compute the sum to get the final encoded digit for the zip code. The table below shows the encoding for 10100. Bar Code Digits Value Product of Digit Value Zip Code Digit 7 0 2 0+0 9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
