Write and run a complete MARIE assembly program to do this:
Read in and store 11 integers, each in the range 0-9 (inclusive) - the first 11 digits in a sPC-A code (the numbers at the bottom of a bar code) for some product Calculate the UPC-A check digit Output the check digit to the user
UPC codes (Universal Product Codes, most commonly UPC-A) are printed on many products in our daily lives. The numbers in the code are encoded into black and white bars and printed on the product packaging, for scanners to read. In every UPC-A code, the final (rightmost) digit is a "check digit," included to help prevent small errors in reading, copying and scanning.
The "check digit" in a UPC-A code is the 12th digit, printed to the right and slightly below the rightmost black bar.
For example, the UPC-A code on a pack of cards in my office is:
0 73854 60088 7 check = 0 + 3 + 5 + 6 + 0 + 8 = 22 check = 22 * 3 check = 66 + 7 + 8 + 4 + 0 + 8 = 93 check = 93 % 10 = 3 (93 modulus 10) check = 10 - 3 = 7, which is the check digit
MARIE does not have a division operation, so you may want to consider repeated subtraction.
A significant part of the grade for this lab will be determined by good programming style. Good programming style, in this case, will include carefully decomposing the problem into meaningful units of work, naming those units well, use of JnS to appropriately navigate around your source code, and, of course, clear, readable comments.
Every single line of code in your program must have a comment clearly explaining the purpose of that line. No exceptions. The comment on the top line of the source code file must include your first and last names. (Lines of source code specifying variable values should be commented appropriately, as well.)
Be careful to test your program on several real UPC-A codes. The professor has several items you may use if there are no bar codes on any items in your backpack.
Last updated 5/2/2024