A barcode scanner for Universal Product Codes (UPCS) verifies the 12-digit code scanned by comparing the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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) 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)
Expert Answer:
Related Book For
Systems analysis and design in a changing world
ISBN: 978-1423902287
5th edition
Authors: John W. Satzinger, Robert B. Jackson, Stephen D. Burd
Posted Date:
Students also viewed these programming questions
-
Write a program that prompts the user to enter three strings. Compare the String objects lexicographically and print the middle-valued string. For example, if the three strings were "abcd", "wxyz",...
-
Write a program that prompts the user to enter a hex digit and displays its corresponding binary number in four digits. For example, hex digit 7 is 0111 in binary. Hex digits can be entered either in...
-
Write a program that prompts the user to enter the exchange rate from currency in U.S. dollars to Chinese RMB. Prompt the user to enter 0 to convert from U.S. dollars to Chinese RMB and 1 to convert...
-
As an agricultural engineer, you must design a trapezoidal open channel to carry irrigation water (Figure). Determine the optimal dimensions to minimize the wetted perimeter for a cross-sectional...
-
Peters Bowling Inc. operates several bowling centres for games and equipment sales. The transactions on the following page occurred in October 2014. Required 1. For each transaction, indicate in the...
-
Li- Na and Shirley both live two periods. Both have earnings of 1,000 in the present and zero in the future. The interest rate is 8 percent. Suppose that they are each subject to an income tax, and...
-
The time to prepare a slide for high-throughput genomics is a Poisson process with a mean of two hours per slide. What is the probability that 10 slides require more than 25 hours to prepare?
-
Namiki, CPA, is auditing the financial statements of Taylor Corporation for the year ended December 31, 2013. Namiki plans to complete the fieldwork and sign the auditors report about March 10, 2014....
-
Consider the following sets. A {1,2,3,4), B (2,3,5), and C = {x|0 < - <6 and x is an integer }. (1 point each) 1. Write the union of sets A and C by enumeration. 2. Is A a subset of C? If so, is it...
-
Handy Howard's Incorporated, is a student co-op. Handy Howard uses a perpetual Inventory system, The following transactions (summarized) have been selected for analysis: a. Sold merchandise for cash...
-
In the context of determining pricing models, which of the following best defines cost-plus pricing? Group of answer choices A. a model in which a product is sold at as low a price as possible while...
-
A DVCs population is growing 2 percent per year and its output is growing 3 percent per year. If the government wants to improve living standards over the coming decades, which of the following would...
-
At the beginning of July, Patti Dwyer established PD Company, investing \(\$ 20000\) cash in the business. On 5 July the company purchased land and a building, making a \(\$ 6000\) down payment...
-
If an investment has 35 percent more nondiversifiable risk than the market portfolio, its beta will be: a. 35 b. 1.35 c. 0.35
-
If a $50 billion initial increase in spending leads to a $250 billion change in real GDP, how big is the multiplier? a. 1.0 b. 2.5 c. 4.0 d. 5.0
-
What are the two parts of the Feds dual mandate? How does the dual mandate relate to the bullseye chart? Which quadrants of the bullseye chart give conflicting signals to the Fed and what is the...
-
Case3: Al-Aqsa charity is a Non-profit organization to improve quality of life for others at a community. Use the below Adjusted Trial Balance on .December 31-2022 to prepare the financial statement...
-
Find the numerical value of each expression. (a) sech 0 (b) cosh -1 1
-
List the types of documentation needed to support maintenance activities. Which documentation types are needed most frequently? Which are needed least frequently?
-
What is BPR? What does it have to do with systems analysis?
-
Draw and explain the symbols used on an activity diagram?
-
Draw a demand and supply graph for the federal funds market to show the demand and supply of reserves in the current ample-reserves regime. How can the Fed increase the federal funds rate? Show the...
-
What is the zero lower bound in monetary policy? What tools can the Fed use if it wants to implement an expansionary monetary policy at the zero lower bound?
-
How did the Fed hit its target for the federal funds rate in the pre-2008 scarce-reserves regime?
Study smarter with the SolutionInn App