Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 )

 

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. [step 1]Calculate the sum of the digits in the odd-numbered positions (the first, eleventh digits) and multiply this sum by 3. third, II. [step 2]Calculate the sum of the digits in the even-numbered positions (the second, fourth, ., tenth digits) and add result(result of step1). this to the previous 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 O of the array. (clue: "check" function takes two argument and it doesnt return any value)

Step by Step Solution

3.32 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems analysis and design in a changing world

Authors: John W. Satzinger, Robert B. Jackson, Stephen D. Burd

5th edition

9780324593778, 1423902289, 9781305117204, 324593775, 978-1423902287

More Books

Students also viewed these Programming questions

Question

Will other people benefit if I act according to this value?

Answered: 1 week ago

Question

What is BPR? What does it have to do with systems analysis?

Answered: 1 week ago

Question

Draw and explain the symbols used on an activity diagram?

Answered: 1 week ago