scan (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: I. [step...


scan<br>(UPCS) verifies the 12-digit code scanned by comparing the<br>code's last digit (called a check digit ) to its own<br>computation of the check digit from the first 11 digits as<br>follows:<br>I. [step 1]Calculate the sum of the digits in the<br>odd-numbered positions<br>eleventh digits) and multiply this sum by 3.<br>(the first,<br>third,<br>II. [step 2]Calculate the sum of the digits in the<br>even-numbered positions (the second, fourth, .,<br>tenth digits) and add this to the previous<br>result (result of stepl).<br>III. [step 3]If the last digit of the result from step<br>2 is 0, then o is the check digit. Otherwise,<br>subtract the last digit from 10 to calculate the<br>check digit.<br>IV. [step 4]If the check digit matches the final digit<br>of the 12-digit UPC, the UPC is assumed correct.<br>1. Write main function that prompts the user to enter<br>the 12 digits of a barcode. The program should<br>store the digits in an integer array.<br>2. Write a

Extracted text: scan (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: I. [step 1]Calculate the sum of the digits in the odd-numbered positions eleventh digits) and multiply this sum by 3. (the first, third, II. [step 2]Calculate the sum of the digits in the even-numbered positions (the second, fourth, ., tenth digits) and add this to the previous result (result of stepl). III. [step 3]If the last digit of the result from step 2 is 0, then o is the check digit. Otherwise, subtract the last digit from 10 to calculate the check digit. IV. [step 4]If the check digit matches the final digit of the 12-digit UPC, the UPC is assumed correct. 1. Write main function that prompts the user to enter the 12 digits of a barcode. The program should store the digits in an integer array. 2. Write a "check" function to 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 array. (clue: "check" function takes argument and it doesnt return any value) two

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here