I have this assignment and don't know how to continue it.
Write a program that prompts for and reads a 12-digit barcode and then validates the barcode as described by the algorithm: we dissect a barcode into d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10, and d11 the scanned check digit.
1. Determine z; the calculated digit as follows: x= 3*(d0+d2+d4+d6+d8+d10)+(d1+d3+d5+d7+d9)
2. y= the last digit in x
3. if y = 0, then z=0; otherwise, z= 10-y
4. If d11=z then upc is valid