Question
Use Object Oriented Java. POSTNET ( Post al N umeric E ncoding T echnique) was a barcode used by the United States Postal Service to
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started