Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use C++ 3. [30 pts] POSTNET Barcode The USPS used a code named POSTNET to direct mail based on ZIP code until 2009. The
Please use C++
3. [30 pts] POSTNET Barcode The USPS used a code named POSTNET to direct mail based on ZIP code until 2009. The bar code consists of full- or half-bars as shown in Figure 2. Figure 2: Example Postnet Barcode The codes are encoded as 1 for a full bar and 0 for half bar. The bar code above would then be encoded as: 110100101000101011000010011. The first and last digits of the bar code are always 1. Removing these leaves 25 digits or a 5-digit ZIP code. For the code above the digits are encoded as follows: 1010010100010101100001001. Each decimal digit is encoded as 5 bars (2 full, 3 half) such that each digit corresponds to a given weight as follows (left to right) 7, 4, 2, 1, 0. Multiply the corresponding value with the digit and compute the sum to get the final encoded digit for the zip code. The digit 'o' is special, encoded as 11000 or a decimal 11, as there have to be two full bars per digit. The entire encoding is given in the Figure 3. get the final, Multiply thch digit corr Figure 3: Postnet Barcode Encoding Numeric | Binary code Barco de Value Value Value 00011 00101 ull 00110 01001 | 01010 em 000 01100 10001 ul. IL.. 10010 Lul. 10100 11000 Write a Zipcode class that encodes and decodes five-digit bar codes used in POST- NET. The class should have two constructors. First constructor should input the zip- code as an integer and the second constructor should input the zip code as a bar code string consisting of Os and is as described above. Although you have two ways to in- put the zip code, internally the class should only store the zip code using the integer format. The class should have at least two public member functions: one to return the zip code as an integer and the other to return it as a string. Any other helper func- tions should be declared as private. Show the output of your code for the following two cases: 23456 and "110100110000010100011110001Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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