Pure Programmer
Blue Matrix


Cluster Map

Project: License Plate Generator (Revisited)

Assume that you supply software for the Department of Motor Vehicles in all 50 states. Write a program that generates all the possible license plate numbers and then prints the total number of plates at the very end. Your program should accept one command line argument that provides the pattern to use when generating licenses. Any of the characters 'A'-'Z' represents the alpha characters in the plate number whereas any of the characters '0'-'9' represents digits. Any other character just represents itself.

Your program should contain a function that accepts one character from the pattern and returns an array containing all the possible characters that character could represent. For the alphabetic pattern don't allow 'I', 'O' and 'S' letters because they can be confused with digits.

Start with license plate numbers that use the pattern ABC-123. Run the program with the pattern that your state uses. See [[License Plate Designs]]. Make sure your program works with the following patterns:

American Samoa1234
Arkansas123 ABC
California1ABC234
Delaware123456
MissouriAB1 C2D
Nevada12A-345
Rhode Island123-456
TennesseeA12-34B

Output
$ swiftc LicensePlates2.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation) $ swiftc LicensePlates2.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation) $ swiftc LicensePlates2.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation) $ swiftc LicensePlates2.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution