programming java language

posted by .

For faster sorting of letters, the postal service encourages companies that send large volumes of mail to use bar code denoting the ZIP code (see figure below).

Student XXXX
PO Box 34689 Jeddah
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 21478 is 22, so the check digit is 8 to make the sum equal to 30.
Each digit of the ZIP code, and the check digit, is encoded according to the following table, where 0 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

0.7+1.4+1.2+0.1+0.0 = 6

The only exception is 0, which will yield 11 according to the weight formula.
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, 21478 becomes
| | : : | : : : : | | : | : : | | : : : | : : | : | : : | : |

You are requested to design the appropriate classes and supply the appropriate methods. Your solution must be Object Oriented (OO).

  • programming java -

    You will certainly need a class and associated methods for decoding and printing the bar-codes.

    Whether you would make a class to encapsulate the input and output is up to you, or your instructor.

    The instructions for printing the bar-code looks complex, but it is the easy part, and fun to do.

    Do some high-level planning (classes, methods, state variables, etc.) before plunging into the pseudocode, or actual coding.

    Post if you have progress or problems.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Data Management (Math)

    A Canadian postal code uses six characters. The first, third, and fifth are letters, while the second, fourth, and sixth are digits. A U.S.A zip code contains five characters, all digits. How many codes are possible for each country?
  2. postal service/mail delivery

    Given that today is Thurs., Dec. 29th, 2011, will any parts of the postal system be running or not in the next few days?
  3. Java Programming

    I'm new to Java and I'm not sure how to write the source code for this problem I got in class... Write a java program using the while and if statement that will accept ten student grades and that will display the sum of the grades, …
  4. Math

    Challenge Write a 6 - digit number that has a 5 in the ten thousand place , a 3 in the thousands place ,a 4 in the tens place , and one digit that is 0.underline the 5,3,4,and the 0 in your number .is this the only number you could …
  5. Computer Literary

    Which of the following is Not an example of debugging A)Looking for errors in programming code B)Fixing misspelled commands in programming code C)Solving faulty logic in programming code D)Upgrading to improve the programming code
  6. itcs 1140

    Homework # 4 ~ Strategic Planning for Wy’East Coffee solve it on pyhon A good friend of yours, Madeline, owns a small, rather successful coffee shop near center campus. She has gathered some data in an Excel spreadsheet over the …
  7. pseudo code algorithm

    Convert your algorithm from Question One into a complete Java application. Marks will be allocated based upon: ● Your Java code matching your pseudo code algorithm from Question One. ● Your Java code being syntactically …
  8. statistics

    A zip-code is a five-digit number identifying where in the U.S. an address is located. The first four digits in a zip code can be any number 0-9, but the fifth digit cannot be 0. In addition to this, each address has a “plus-four” …
  9. English

    When we send letters, we write 'zip code' on the envelope. What is the meaning of 'zip'?
  10. English

    1. Do you know the zip code for Dokdo? 2. Do you know what the zip code for Dokdo is?

More Similar Questions