Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ Thank You Until 2009, the US Postal Service printed a bar code on every envelope that represented the zip code using a format
In C++
Thank You
Until 2009, the US Postal Service printed a bar code on every envelope that represented the zip code using a format called POSTNET. We will be doing the same with only 5-digit zip codes. POSTNET consists of long and short lines, as seen below: Illulululilullul 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 l represents a number. When the numbers that the l's represent are added together, you get that digit of the zip code. The table below translates the first group, which represents the number 6. POSTNET Digits Value 74 2 1 0 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 itStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started