Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

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.
expand button
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.
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education