Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overview: Postal barcode (Exercise 2.1.36). The initial barcode used by the U.S Postal System to route mail is defined as follows: Each decimal digit in

image text in transcribed
image text in transcribed
Overview: Postal barcode (Exercise 2.1.36). The initial barcode used by the U.S Postal System to route mail is defined as follows: Each decimal digit in the ZIP code is encoded using a sequence of three half-height and two full-height bars. The barcode starts and ends with a full-height bar (the guard rail) and includes a checksum digit (after the five-digit ZIP code or the nine-digit ZIP +4 code), computed by summing up the original digits modulo 10 Implement the following functions . Draw a half-height or full-heigh bar on StdDraw. e Given a digit, return the binary code of that digit as a String. Compute the checksum digit. . Given a String of I's and 0's, draw the corresponding barcode in which I's are full height bars and 0's are half-height bars. The barcode should be centered in the StdDraw canvas Implement a test client that reads in a five or nine digit ZIP code as the command line argument and draws the corresponding postal barcode. Details: .Name the program PP2. java. . Use the following table to map a digit to barcodes digit bar code binary code 11000 00011 00101 00110 01001 01010 01100 10001 10010 10100 all The binary code use 1 for full-height and 0 for half-height bars of the barcode .The width of a bar should be in of the height of the full-height bar . The space between bars should be the same as the width of a bar Current postal bar code uses four different size bars and encodes additional tracking information . Use an appropriate height to make it easy to see the barcode when displayed (if printed, we would want 24 bars per inch). The checksum digit is the value when added to the sum of the original digits, causes the sum modulo 10 to be zero. Example: digits 08 54 0 would sum to 17. The checksum would be 3 as (17+3) modulo 10 is zero. Note that this differs from the textbook example of 7 .Validate the command line parameters. If invalid values are given then print out a warning message. Your program should display your name and lab CRN at the top of the StdDraw canvas showing the barcode. StdDraw provides a set of functions for writing text to the display . The original Zip code and the calculated checksum digit should be displayed at the bottom of the StdDraw canvas. the barcode should be centered in the middle of the StdDraw canvas. Submit: the source code file PP2. java to Dropbox on Brightspace. Grading Guidelines Program compiles on command line Required for non-zero score Program submitted on D2L Proper style and comments Input validation Functions: Required for non-zero seore 10% 10% drawbar 10% digit to code 20% checksum 10% draw barcode 20% test client (nnan method) 20%

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions