Question: Please don't just copy and paste the answer... Main function must not be altered. Until 2009, the US Postal Service printed a bar code on

Please don't just copy and paste the answer... Main function must not be altered.

Please don't just copy and paste the answer... Main function must notbe altered. Until 2009, the US Postal Service printed a bar codeon every envelope representing the zip code using a format called POSTNET.We will be doing the same with 5-digit zip codes. POSTNET consists

Until 2009, the US Postal Service printed a bar code on every envelope representing the zip code using a format called POSTNET. We will be doing the same with 5-digit zip codes. POSTNET consists of long and short lines, as seen below.: lIImIImIlInIIII The POSTNET representation of 67260, WSU's zip code In the program, the zipcode will be represented by an integer and the corresponding barcode will be represented by strings of digits. The digit 1 will represent the long bar, and the digit 0 will represent the short bar. The first and last digits of a POSTNET code are always 1. Stripping these leaves 25 digits, which can be split into groups of 5. The above example translates into the following string and groups of five: 101100100010010101100110001 01100 10001 00101 01100 11000 Now, we look at each group of 5. There will always be two 1's. Depending on its location within the group, each 1 represents a number. When the numbers that the 1's represent are added together, you get that digit of the zip code. The table below translates the underlined group, which represents the number 6 POSTNET Digits Value 0 11 0 0 74 2 10 We see that the 1's correspond to the values of 4 and 2, respectively. Adding them up gives us 6, which is the first digit of the zip code (and also the fourth since the same group appears again, due to the zip code having two 6's) In order to represent the number 0, the 1's will add up to a value of 11. This is done because of the requirement that every group of five always has two 1's in it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!