subject

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:
I. [step 1]Calculate the sum of the digits in the
odd-numbered positions (the first, third, ...,
eleventh digits) and multiply this sum by 3.

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 step1).

III. [step 3]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.

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 two
argument and it doesnt return any value)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
The salespeople at hyperactive media sales all use laptop computers so they can take data with them on the road. you are a salesperson for superduper lightspeed computers talking to hyperactive media sales about upgrading the laptops to windows 10. explain how network location awareness in windows 10 would make the laptops more secure.
Answers: 3
question
Computers and Technology, 23.06.2019 20:30
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
question
Computers and Technology, 24.06.2019 09:30
What is the definition of digital literacy?
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
When workers demonstrate patience, are able to manage there emotions, and get along with other employees, which skills are being displayed?
Answers: 1
You know the right answer?
A barcode scanner for Universal Product Codes (UPCs) verifies the 12-digit code scanned by compari...
Questions
question
Mathematics, 28.10.2020 02:00
question
Mathematics, 28.10.2020 02:00
question
Mathematics, 28.10.2020 02:00
question
Spanish, 28.10.2020 02:00
question
Mathematics, 28.10.2020 02:00
question
Mathematics, 28.10.2020 02:00
question
Advanced Placement (AP), 28.10.2020 02:00
Questions on the website: 13722360