Menu

[Solved]Background Barcode Scanner Universal Product Codes Upcs Verifies 12 Digit Code Scanned Com Q37105748

Please write a JAVA program by following requirement.Thanks!Background: A barcode scanner for Universal Product Codes (UPCs) verifies the 12-digit code scanned by comparing the codes lRequirements Write a program that prompts the user to enter the 12 digits of a barcode separated by spaces. The program shoul

Background: A barcode scanner for Universal Product Codes (UPCs) verifies the 12-digit code scanned by comparing the code’s last digit (called a check digit) to its own computation of the check digit from the first 11 digits as follows: – 1. Calculate the sum of the digits in the odd-numbered positions (the first, third, …, eleventh digits) and multiply this sum by 3. – Calculate the sum of the digits in the even-numbered positions (the second, fourth, …, tenth digits) and add this to the previous result.. If the last digit of the result from step 2 is 0, then 0 is the check digit. Otherwise, subtract the last digit from 10 to calculate the check digit. If the check digit matches the final digit of the 12-digit UPC, the UPC is assumed correct. 2. 3. 4. Requirements Write a program that prompts the user to enter the 12 digits of a barcode separated by spaces. The program should store the digits in an integer array, calculate the check digit, and compare it to the final barcode digit. If the digits match, output the barcode with the message “validated.” If not, output the barcode with the message “error in barcode.” Also, output with labels the results from steps 1 and 2 of the check-digit calculations. Note that the “first” digit of the barcode will be stored in element 0 of the arrav. Try your program on the following barcodes, three of which are valid. For the first barcode, the result from step 2 is 79 (0+9+0+8+4 +0) 3+(7+4+0 +0+5). ” 079400804501 02400 0 16286 0 011110856807 05100 0 13810 1 A few specifics: Name your class Program11. Break this problem into small single-purpose methods. Any method should not be longer than 12 lines long (plus comments). Your code should have at least two methods that either have array as input parameter or return array. To submit, create a folder named program11. It should contain only Program11.java. Then, zip and submit that folder.* . . . Sample run: Enter the UPC you want to check: 7 9 4 0 0 8 0 4 5 0 1 +’ The sum of the digits in the odd-numbered positions21 The sum of the digits in the even-numbered positions = 16- The weighted sum79- The last digit of the weighted sum 9- The check digit – 1- The bar code you entered is 0 7 9 4 0 0 8 0450 1 The bar code is validated Enter the UPC you want to check: 0 2 4 0 0 0 1 6 2 8 6 0 +’ The sum of the digits in the odd-numbered positions13 The sum of the digits in the even-numbered positions = 16- The weighted sum 55- The last digit of the weighted sum 5- The check digit -5 The bar code you entered is 0 2 4 0 0 1 6 2 8 6 0 Error in barcode Show transcribed image text Background: A barcode scanner for Universal Product Codes (UPCs) verifies the 12-digit code scanned by comparing the code’s last digit (called a check digit) to its own computation of the check digit from the first 11 digits as follows: – 1. Calculate the sum of the digits in the odd-numbered positions (the first, third, …, eleventh digits) and multiply this sum by 3. – Calculate the sum of the digits in the even-numbered positions (the second, fourth, …, tenth digits) and add this to the previous result.. If the last digit of the result from step 2 is 0, then 0 is the check digit. Otherwise, subtract the last digit from 10 to calculate the check digit. If the check digit matches the final digit of the 12-digit UPC, the UPC is assumed correct. 2. 3. 4.
Requirements Write a program that prompts the user to enter the 12 digits of a barcode separated by spaces. The program should store the digits in an integer array, calculate the check digit, and compare it to the final barcode digit. If the digits match, output the barcode with the message “validated.” If not, output the barcode with the message “error in barcode.” Also, output with labels the results from steps 1 and 2 of the check-digit calculations. Note that the “first” digit of the barcode will be stored in element 0 of the arrav. Try your program on the following barcodes, three of which are valid. For the first barcode, the result from step 2 is 79 (0+9+0+8+4 +0) 3+(7+4+0 +0+5). ” 079400804501 02400 0 16286 0 011110856807 05100 0 13810 1 A few specifics: Name your class Program11. Break this problem into small single-purpose methods. Any method should not be longer than 12 lines long (plus comments). Your code should have at least two methods that either have array as input parameter or return array. To submit, create a folder named program11. It should contain only Program11.java. Then, zip and submit that folder.* . . . Sample run: Enter the UPC you want to check: 7 9 4 0 0 8 0 4 5 0 1 +’ The sum of the digits in the odd-numbered positions21 The sum of the digits in the even-numbered positions = 16- The weighted sum79- The last digit of the weighted sum 9- The check digit – 1- The bar code you entered is 0 7 9 4 0 0 8 0450 1 The bar code is validated Enter the UPC you want to check: 0 2 4 0 0 0 1 6 2 8 6 0 +’ The sum of the digits in the odd-numbered positions13 The sum of the digits in the even-numbered positions = 16- The weighted sum 55- The last digit of the weighted sum 5- The check digit -5 The bar code you entered is 0 2 4 0 0 1 6 2 8 6 0 Error in barcode

Expert Answer


Answer to Background: A barcode scanner for Universal Product Codes (UPCs) verifies the 12-digit code scanned by comparing the cod… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *