Use this table to convert digits to barcode representation and vice-versa; each digit is represented in 5 characters; so 1 will be represented as 00011; as 0 is represented as half bar (:) and 1 is a full bar (1) ; 1 will be represented as  :::||  ; similarly 9 is 10100 and will be represented as |:|:: Write a program that asks the user for a ZIP code and prints the bar code. Use : for half bars, | for full bars. For example, 95014 becomes ||:|:::|:|:||::::::||:|::|:::||| Your program should also be able to carry out the opposite conversion: Translate bars into their ZIP code, reporting any errors in the input format or a mismatch of the digits. java

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

 

Use this table to convert digits to barcode representation and vice-versa; each digit is represented in 5 characters; so 1 will be represented as 00011; as 0 is represented as half bar (:) and 1 is a full bar (1) ; 1 will be represented as  :::||  ; similarly 9 is 10100 and will be represented as |:|::

Write a program that asks the user for a ZIP code and prints the bar code. Use : for half bars, | for full bars. For example, 95014 becomes

||:|:::|:|:||::::::||:|::|:::|||

Your program should also be able to carry out the opposite conversion: Translate bars into their ZIP code, reporting any errors in the input format or a mismatch of the digits.

java

Each digit of the ZIP code, and the check digit, is
encoded according to the table below, where 0
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 computed easily from
the bar code using the column weights 7, 4, 2, 1,
O. For example, 01100 is
0 x 7 + 1 × 4 + 1 × 2 + 0 × 1 + 0 × 0 = 6
The only exception is 0, which would yield 11
according to the weight formula.
Transcribed Image Text:Each digit of the ZIP code, and the check digit, is encoded according to the table below, where 0 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 computed easily from the bar code using the column weights 7, 4, 2, 1, O. For example, 01100 is 0 x 7 + 1 × 4 + 1 × 2 + 0 × 1 + 0 × 0 = 6 The only exception is 0, which would yield 11 according to the weight formula.
The encoding scheme for a five-digit ZIP code is
shown in Figure 9. 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 sum of the digits in the ZIP code
95014 is 19, so the check digit is 1 to make the
sum equal to 20.
Transcribed Image Text:The encoding scheme for a five-digit ZIP code is shown in Figure 9. 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 sum of the digits in the ZIP code 95014 is 19, so the check digit is 1 to make the sum equal to 20.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 7 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education