Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Object Oriented Java. POSTNET ( Post al N umeric E ncoding T echnique) was a barcode used by the United States Postal Service to

Use Object Oriented Java. POSTNET(PostalNumericEncodingTechnique) was a barcode used by the United States Postal Service to assist in sorting and directing mail. The ZIP+4 code is encoded in half- and full-height bars. The barcode starts and ends with a full bar called the frame bars. Each individual digit is represented by a set of five bars, two of which are full bars and three half bars, in a pseudo-binary code as in table 1.

The complete bar code consists of a start full frame bar, the 9 digit barcodes, a check digit barcode, and a stop full frame bar.

The check digit is computed as follows:

1) Add all nine digits and compute the remainder of the sum when divided by 10.

2) If the remainder is zero, the check digit is zero.

3) Otherwise, the check digit is ten minus the remainder.

Example:

The ZIP+4 of55555-1237yields a check digit of2for encoded data of5555512372 Together with the start and stop frame bars, this would be represented as:

You can use the following data declarations to encode the barcode for each digit.

public static final char FB='\u2503',HB='\u257b'; private static String[] barcode = { ""+FB+FB+HB+HB+HB, ""+HB+HB+HB+FB+FB, ""+HB+HB+FB+HB+FB, ""+HB+HB+FB+FB+HB, ""+HB+FB+HB+HB+FB, ""+HB+FB+HB+FB+HB, ""+HB+FB+FB+HB+HB, ""+FB+HB+HB+HB+FB, ""+FB+HB+HB+FB+HB, ""+FB+HB+FB+HB+HB};

FB is a unicode full bar and HB is a unicode half bar. barcode[digit] is the barcode for that digit.

Make a class Postnet with a constructor that takes a 9-digit zip+4 code and a method public String barCode() that returns the barcode for that zip+4. Write a test program to ask the user for a zip+4 code and then print the corresponding bar code.

Another example:

Imperial Valley College 380 E ATEN RD IMPERIAL CA 922519653

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

Combinatorial Testing In Cloud Computing

Authors: Wei-Tek Tsai ,Guanqiu Qi

1st Edition

9811044805, 978-9811044809

More Books

Students also viewed these Programming questions

Question

If a b and what is the value of b? 9 1 D-9 9-D b-a 720 | ab

Answered: 1 week ago

Question

b. What is the probability that the family has four children?

Answered: 1 week ago