Question: To create your Exercise 1 solution: Create a C++ program which will ask the user to provide the UPC code for a particular item. Review
To create your Exercise 1 solution: Create a C++ program which will ask the user to provide the UPC code for a particular item. Review the document on wikipedia.
The Algorithm:In the UPC-A system, the check digit is calculated as follows:
Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three. Note: the smaller sized first number in the UPC starts the sequence. The last smaller sized digit is the check digit.
Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result. Note: the smaller sized first number in the UPC starts the sequence. The last smaller sized digit is the check digit.
Find the result modulo 10 (i.e. the remainder when divided by 10.. 10 goes into 58 5 times with 8 leftover).
If the result is not zero, subtract the result from ten.
The Specs: Your solution should prompt the user for the UPC numbers.
Your solution should report to the user if the UPC code in valid or not.
The user should be able to enter multiple tests.
.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
