Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COMP.2010 HW 04 SP18 - Dr. Lin Due date: 02-16-2018 (F) 11am Close date: 03-02-2018(F), 11am Submission: a C++ file (hw4.cpp) on Blackboard Points: 30

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

COMP.2010 HW 04 SP18 - Dr. Lin Due date: 02-16-2018 (F) 11am Close date: 03-02-2018(F), 11am Submission: a C++ file (hw4.cpp) on Blackboard Points: 30 Description The bar code on an envelope used by the US Postal Service represents 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 For this program we will represent the bar code as a string of digits. The digit 1 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 1'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 0 0 Value 0 0 Product of Digit Value 0 Zip Code Digit = 7 +0+2+0+0-9 Repeat this for each group of five digits and concatenate to get the complete zip code. There is one special value. If the sum of a group of five digits is 11, then this represents the digit 0 (this is necessary because with two digits per group it is not possible to represent zero). The zip code for the sample bar COMP.2010 HW 04 SP18 - Dr. Lin Due date: 02-16-2018 (F) 11am Close date: 03-02-2018(F), 11am Submission: a C++ file (hw4.cpp) on Blackboard Points: 30 Description The bar code on an envelope used by the US Postal Service represents 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 For this program we will represent the bar code as a string of digits. The digit 1 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 1'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 0 0 Value 0 0 Product of Digit Value 0 Zip Code Digit = 7 +0+2+0+0-9 Repeat this for each group of five digits and concatenate to get the complete zip code. There is one special value. If the sum of a group of five digits is 11, then this represents the digit 0 (this is necessary because with two digits per group it is not possible to represent zero). The zip code for the sample bar

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How is trade dress different from a trademark?

Answered: 1 week ago

Question

4. Describe cultural differences that influence perception

Answered: 1 week ago