Question: Most products now sold are assigned a code which uniquely identifies the product. The ACME Company uses a 1 0 digit product number that is

Most products now sold are assigned a code which uniquely identifies the product. The ACME Company uses a 10 digit product number that is normally a sequence of 10 decimal digits, but in some cases, the capital 'A' may also appear as the tenth digit. Hyphens may be included at various places in the product number to make them easier to read, but have no other significance. The sample input and expected output shown below illustrate many valid, and a few invalid, forms for product numbers.
Actually, only the first nine digits in a product number are used to identify a product. The tenth character serves as a checksum to verify that the preceding digits are correctly formed. This checksum is selected so that the value computed as shown in the following algorithm is evenly divisible by 11.
A checksum is important because it allows for the quick detection of errors when entering or transmitting data, reducing the risk of errors going unnoticed and resulting in incorrect or invalid data.
Since the checksum may sometimes need to be as large as 10 to guarantee divisibility by 11, and the representation of the number 10 requires 2 digits (1 to many), a special symbol was selected by Acme Company to represent 10, and that is the role played by 'A'.
The algorithm used to check a product number is relatively simple. Two sums, sum1 and sum2, are computed over the digits of the product number, with sum2 being the sum of the partial sums in sum1 after each digit of the product number is added to it. The checksum is the value that, when added to sum2, makes the total sum evenly divisible by 11.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!