Question: VIN numbers. A VIN number is a 1 7 - character string that uniquely identifies a motor vehicle. It also encodes the manufacturer and attributes

VIN numbers. A VIN number is a 17-character string that uniquely identifies a motor
vehicle. It also encodes the manufacturer and attributes of the vehicle. To guard
against accidentally entering an incorrect VIN number, the VIN number incorporates
a check digit (the 9th character). Each letter and number is assigned a value
between 0 and 9. The check digit is chosen so to be the weighted sum of the values
mod 11, using the symbol X if the remainder is 10.
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
12345678-12345-7-923456789
1st 2nd 3rd 4th 5th 6th 7th 8th 9th 1011121314151617
876543210098765432
For example the check digit of the partial VIN number 1FA-CP45E-?-LF192944 is X
because the weighted sum is 373 and 373 mod 11 is 10.
1 F A C P 45 E X L F 192944
16137455-36192944
876543210-98765432
------------------------------------------------------------------
84261528121050-27487541036128
Write a program that takes a string and determines whether or not it is a valid VIN
number. Allow the input to be entered with upper or lower case, and allow dashes to
be inserted.
Do thorough error checking, e.g., that the string is the right length, that no illegal
characters are used (I, O, Q), etc.
With a working example please.

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 Programming Questions!