Question: Printing US postal bar code. Python Language Problem specification: Write a program that asks the user to enter a zip code (in ZIP+4 format) then

Printing US postal bar code. Python Language

Problem specification: Write a program that asks the user to enter a zip code (in ZIP+4 format) then encode the zip code and prints out the barcode (note: this is the old format barcode.)

Challenge (optional): (1) instead of ZIP+4, if a user enters just zip code say 55555, the program will automatically treat it as 55555-0000; (2) implement your own module for the displaying the digits.

Problem background information: The following table shows the encoding for decimal digits. Check sum is (10-sum mod 10).

Digit

7 4 2 1 0

Barcode

0

1 1 0 0 0

 Printing US postal bar code. Python Language Problem specification: Write a

1

0 0 0 1 1

program that asks the user to enter a zip code (in ZIP+4

2

0 0 1 0 1

format) then encode the zip code and prints out the barcode (note:

3

0 0 1 1 0

this is the old format barcode.) Challenge (optional): (1) instead of ZIP+4,

4

0 1 0 0 1

if a user enters just zip code say 55555, the program will

5

0 1 0 1 0

automatically treat it as 55555-0000; (2) implement your own module for the

6

0 1 1 0 0

displaying the digits. Problem background information: The following table shows the encoding

7

1 0 0 0 1

for decimal digits. Check sum is (10-sum mod 10). Digit 7 4

8

1 0 0 1 0

2 1 0 Barcode 0 1 1 0 0 0 1 0

9

1 0 1 0 0

0 0 1 1 2 0 0 1 0 1 3 0

Start/Stop

1

0 1 1 0 4 0 1 0 0 1 5 0

Example: The ZIP+4 of 55555-1237 yields a check digit of 2 for encoded data of 5555512372 Together with the initial and terminal frame bars, this would be represented as:

1 0 1 0 6 0 1 1 0 0 7 10 0 0 1 8 1 0 0 1 0 9 10 1 0 0 Start/Stop 1 Example: The ZIP+4 of 55555-1237 yieldsa check digit of 2 for encoded data of 5555512372 Together withthe initial and terminal frame bars, this would be represented as: Yourprogram should import a digitprint module (see attachment) that has print_zero(), print_one(),print_start_stop() functions (instead of using the given module you can write yourown functions to print out the barcode for digits), write a functionthat reads in a ZIP+4 code and returns a string by removingthe character, another function for generating the check sum, and then amain function that completes the project. Dont forget to call the mainfunction to run. Testing requirements: print out the barcode for: 55555-1237 91768-1234

Your program should import a digitprint module (see attachment) that has print_zero(), print_one(), print_start_stop() functions (instead of using the given module you can write your own functions to print out the barcode for digits), write a function that reads in a ZIP+4 code and returns a string by removing the character, another function for generating the check sum, and then a main function that completes the project. Dont forget to call the main function to run.

Testing requirements:

  1. print out the barcode for: 55555-1237 91768-1234 20500-0000
  2. input 55555 (depends on your program design could display bar code or invalid input)
  3. input 5AB&7 (invalid input)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!