Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For faster sorting of letters, the United States Postal Service uses bar code format to encode the zip code. (See page 2.) Your task is

image text in transcribed
image text in transcribed
For faster sorting of letters, the United States Postal Service uses bar code format to encode the zip code. (See page 2.) Your task is to write a progra input by the user m that displays the bar code for digits that are Wri te an error-free Java progra m to do the following things. Prompts the user to input five integer data values. The five values correspond to the five numbers in a typical zip code. The numbers should be entered one at a time. Inputting all 5 numbers as a single zip code value is possible but I think one-at-a-time will make the program easier From th e main program, call a method that calculates and displays the bar code for each number. The return value on the method should be void; e.g. void printDigit(int d). The bar code for each digit is 5 bars, two of which are tall and three of which are short. I used the ( symbol for the tall bar and the colon () symbol for short bar After the five numbers have been entered (and displayed), call a method to calculate the check digit for the zip code. The check digit is added to the sum of the numbers to make the total sum (five numbers of zip plus check digit)a multiple of 10. For example, for a zip code of 42071, the check digit is 6. Display the bar code for the check digit on the screen. Remember to put the usual header at the top of the program and to submit via Canvas. Sample output DeInput 1 digit of zip code: 4 Input 2 digit of zip code: 2 [Input 3 digit of zip code: 0 Input 4 digit of zip code: 7 0-01::: Input 5 digit of zip code: 1 Sample output *Input 1 digit of zip code: 4 -Input 2 digit of zip code: 2 Input 3 digit of zip code: 0 -Einput 4 digit of zip code: 7 .Input 5 digit of zip code : .check:1 Postal bar code information COSS SUNNYVALE CA 9504-5143 igere & APostal Bar Code The encoding scheme for a five digit zip code is shown in Figure 7. There are t frame bars on each side. The ve encoded digits are followed by a check full digit, wlich is computed as fellows: Add up all digits, and choose the check digit make the sum a multiple of 10. For example, the sip code 95014 has a sm o tS, so the check digit is I to make the sum equal so 20 Figure 7 Encoding for Five Digit Bar Codes Each digit of the nip code,andthe check digi is encoded acconding to dheuable below, where I denotes a full bar and O a half bar Bar 2 lar 3 Bar 4 Digit Bar

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago

Question

LO5 Illustrate the steps in developing a base pay system.

Answered: 1 week ago