Question: Write an error-free Java program to do the following things. Prompts the user to input five integer data values. The five values correspond to the

Write an error-free Java program 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 al 5 numbers as a single zip code value is possible but I think one-at-a-time will make the . program easier. From the 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 printDigitlint d). The bar code for each digit is 5 bars, two of which are tall and three of which are short. I used the (D 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: Minput 1 digit of zip code : 4 Postal bar code information ** ECRLOTCO57 CODE C671RTS2 JOHN DOE 1009 FRANKLIN BLVD SUNNYVALE CA 95014-5143 CO57 Figure 6 A Postal Bar Code The encoding scheme for a five-digit zip code is shown in Figure 7. 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 al digits, and choose the check digit to make the sum a multiple of 10. For example, the zip code 95014 has a sum of 19, so the check digit is 1 to make the sum equal to 20. Frame bars Digit l Digit 2 Digit 3 Digit 4 Digit 5 Check Figure 7 Encoding for Five Digit Bar Codes Each digit of the zip code, and the check digit, is encoded according to the table Digit below, where 1 denotes a full bar and 0 a half bar: Bar 1 Bar 2 Bar 3 Bar 4 Bar 5 igit (weight 7) (weight 4) (weight 2) (weight 1) (weight 0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
