Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Checksum digit is an important error detection measure for integrity check for many codes, including UPC (Universal Product Code) barcodes. Typically, an UPC is a

Checksum digit is an important error detection measure for integrity check for many codes, including UPC (Universal Product Code) barcodes. Typically, an UPC is a 12-digit number where the last digit on the right serves as the checksum digit. The checksum digit can be calculated based on other 11 digits of the UPC and if it does not match with the calculated value, it is certain that there is some error in the code transmission. The checksum digit in a 12-digit UPC is calculated as follows: Step 1: Sum of all digits at odd positions (counting from 1, left to right, 1, 3, 5, 7, 9, 11) Step 2: Sum of all digits at even positions except the last position (counting from left to right, 2, 4, 8, 6, 10 the 12th position is not included in the sum) Step 3: Calculate (3*oddsum) + evensum Step 4: If the result obtained at step 3 leaves remainder 0 when divided by 10, then checksum is 0. Otherwise, the checksum is (10 the remainder when divided by 10). Programming: A sample file has been provided with the assignment description. The file contains 10 different UPCs. Write a Java program to check whether the UPC codes in the sample files are valid. If found invalid, indicate what would be the correct checksum digit (assuming there is no error in other 11 digits). Program execution requirements: 1. The program must accept the input file as a command line argument. The test input file will have similar format as the sample file provided. 2. The output format should be indication of valid or invalid for each UPC on file. If invalid, the output should also indicate the correct checksum digit value. You do not need to write the output onto a file. Just display it on console.

Step by Step Solution

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

What is Accounting?

Answered: 1 week ago

Question

Define organisation chart

Answered: 1 week ago

Question

What are the advantages of planning ?

Answered: 1 week ago

Question

Explain the factors that determine the degree of decentralisation

Answered: 1 week ago