Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE CODE THIS IN C++ Bar Code Exercise Postal Barcodes (Page 1 of 2) For faster sorting of letters, the United States Postal Service encourages
PLEASE CODE THIS IN C++
Bar Code Exercise Postal Barcodes (Page 1 of 2) For faster sorting of letters, the United States Postal Service encourages companies that send large volumes of mail to use a bar code denoting the ZIP code. The encoding scheme for a five-digit ZIP code is shown in Table 1. There are full-height frame bars on each side. The five encoded digits are followed by a correction digit, which is computed as follows: Add up all digits, and choose the correction digit to make the sum a multiple of 10. For example, the ZIP code 95014 has sum of digits 19, so the correction digit is 1 to make the sum equal to 20. Each digit of the ZIP code, and the correction digit, is encoded according to Table 1, where o denotes a half bar and 1 a full bar. Note that they represent all combinations of two full and three half bars. The digit can be easily computed from the bar code. For example, 01100 is o x7 + 1x 4 + 1 x 2 + 0 x 1 + 0 x 0 = 6. The only exception is 0, which would yield 11 according weight formula. Continued on next slide + use at least one function + do not read digits separately Page 24 Bar Code Exercise (cont.) Postal Barcodes (Page 2 of 2) Table 1 0 0 0 1 1 00101 00110 01001 0 1 0 1 0 01100 10001 10010 10100 11000 Write a program that asks the user for a ZIP code and prints the bar code. Use : for half bars, I for full bars. For example, 95014 becomes OJOUWN 1 2 3 4 5 6 7 8 9 0 Where the first and last bar represent frame bars. The general format is: Frame-bar Digit1 Digit2 Digit3 Digit4 Digit5 Check-digit Frame-bar Page 25Step 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