Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to do this in Java it needs to be in 2 classes a Tester class that has the main and a 2nd class with

How to do this in Java it needs to be in 2 classes a Tester class that has the main and a 2nd class with the methods

image text in transcribed

image text in transcribed

image text in transcribed

*** P8.7 For faster sorting of letters, the U.S. Postal Service encourages companies that send large volumes of mail to use a bar code denoting the ZIP code (see Figure 8). *************** ECRLOT ** COS7 CODE C671 RTS2 JOHN DOE 1009 FRANKLIN BLVD SUNNYVALE CA 95014-5143 C057 ILLULLLLLLL Figure 8 A Postal Bar Code 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 I to make the sum equal to 20. Frame bars ILL. Digit II. ... ... ...lli Digit2 Digit 3 Digit+ Dagit 5 Check Digit Figure 9 Encoding for Five-Digit Bar Codes Each digit of the ZIP code, and the check digit, is encoded according to the table at right, where o 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 - Each digit of the ZIP code, and the check digit, is encoded according to the table at right, where o 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, 0. For example, 01100 is OX 7+1 X 4+1 X 2 + OXI+OX0 = 6 The only exception is o, which would yield 11 according to the weight formula. Weight Digit 7 4 2 10 1 00011 2 0 0 1 0 1 3 0 0 1 1 0 4 0 0 0 1 5 01010 6 0 1 1 0 0 7 1 0 0 0 1 8 1 0 0 1 0 9 1 0 1 0 0 0 1 1 0 0 0 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 11:1:::::::::::::::::||| 3 00110 4 0 1 0 0 1 5 01010 6 0 1 1 0 0 7 1 0 0 0 1 8 1 0 0 1 0 9 1 0 1 0 0 0 1 1 0 0 0 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 11:1:::1:1:11::::::11:1:::::||| (Alternatively, write a graphical application that draws real bars.) 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

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

Students also viewed these Databases questions