Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

P5.18 and P5.19 -- Business P5.18 Postal bar codes. For faster sorting of letters, the United States Postal Service encour- ages companies that send large

P5.18

image text in transcribed

image text in transcribed

and P5.19

-- Business P5.18 Postal bar codes. For faster sorting of letters, the United States Postal Service encour- ages companies that send large volumes of mail to use a bar code denoting the zip code (see Figure 9). The encoding scheme for a five-digit zip code is shown in Figure 10. There are full-height frame bars on each side. The five encoded digits are followed by a check digit, which is computed as follows: Add up all digits, and choose the check digit to make the sum a multiple of 10. For example, the zip code 95014 has a sum of 19, so the check digit is 1 to make the sum equal to 20. Each digit of the zip code, and the check digit , is encoded according to the following table where o denotes a half bar and 1 a full bar. *** ECRLOT ** CO57 Framc bars C057 CODE C671 RTS2 JOHN DOE 1009 FRANKLIN BLVD. SUNNYVALE CA 95014-5143 H., lile lui mull lul Tulll Digit 1 Digit 2 Digit 3 Digit 4 Digic 5 Check Digit Figure 10 Encoding for Five-Digit Bar Codes ILL.I.L... LLLLL...LLLLLL Figure 9 A Postal Bar Code Digit Barl (weight 7) Bar 2 (weight 4) (weight 2) (weight 1) (weight 0) 1 0 0 1 1 o 0 1 1 1 1 5 1 1 66 1 1 7 1 0 0 1 03 1 9 1 0 0 c I 1 0 The digit can be easily computed from the bar code using the column weights 7, 4, 2, 1,0. For example, 01100 is Ox7+ 1 X 4+1x2 + 0x 1 + 0x0=6. The only cxcep- cion is 0, which would yield 11 according to the weight formula. 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 11:1:::1:1:||::::::11:1::1:::||| Business P5.19 Write a program that reads in a bar code (with : denoting half bars and denoting full bars) and prints out the zip code it represents. Print an error message if the bar code is not correct

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

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

=+ What may stay the same?

Answered: 1 week ago

Question

What does stickiest refer to in regard to social media

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago