Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task 1 : Checksum for Singapore car license plate number [ Total: 7 0 marks ] A Singapore car license plate, such as SHA 4
Task : Checksum for Singapore car license plate number Total: marks
A Singapore car license plate, such as SHA EA etc., consists of the following:
Prefix consisting of alphabets.
E SHA, SGJ QX FBB E
Numerical series from without leading zeros
Eg
Checksum letter, one of these letters: A Z Y X U T S R P M L K J H G E D C B
The checksum letter of a license plate validates if that license plate is valid or not.
In this task, write a program to calculate the checksum letter given a Singapore vehicle licence plate.
Here is the formula for calculating the checksum letter'
The last letters of the prefix are converted into digits, where dots, and
If there is only letter, then convert that letter into digit, and add a digit to the front.
E and and and
Add leading zeros to the numerical series to make it a digit figure.
Eeno change
Combine the prefox digits and the numerical series to form a series of six numbers.
E S SSS
Each individual numbers are then multiplied by the corresponding position of the six fixed numbers
Eg SS
The multiplied numbers are then added up Eg
Oivide the sum by and get the remainder.
Eg remainder
The remainder corresponds to one of the letters A Z Y X U T S R P M L K J H G E D
C B where remainder corresponds to remainder corresponds to and so on
Eg Checksum letter for remainder
Task a marks
Write a function alphabettodigit c This function takes in an alphabet and converts it into its digit
representation where and Your function should be case insensitive, ie to handle both upper
and lower case alphabets.
Note: You are strongly encouraged to use comments to describe your code where necessary.
Task b marks
Write a function convertpref prefix This function takes in a nonempty alphabet string called
prefix and returns a list of two integers, which are the converted digits of the last two alohabets in orefix.
For our question, we do not limit the number of alphabets in a prefix. ie The prefix can be
SBSBCSBSDBSZBS but still only the last two characters are taken for conversion.
ieSBSBCDZBS should return and E should return
Note: You are strongly encouraged to ure comments to describe your code where necessary.
Task c marks
Write a function convertnumseries numseries This function takes in a nonempty string of at
most four digits a number from the numerical series and returns a list of integers representing exactly Note: You are strongly encouraged to use comments to describe vour code where necessary.
Task c marks
Write a function convertnumseries numseries This function takes in a nonempty string of at
most four digits a number from the numerical series and returns a list of integers representing exactly
digits.
ie should return and should return
Note: You are strongly encouraged to use comments to describe vour code where necessary.
Task d marks
Write a function multiplyandaddseries This function takes in a list of six integers and multiplies
each integer with the corresponding number in to obtain a new list of six integers; it then
returns the sum of these integers.
Note: You are strongly encouraged to use comments to describe vour code where necessary.
Task marks
Task e: Write the function remaindertochecksumletterremainder that takes in an integer
checksum remainder ranging from to obtained in step of the formula and returns the
corresponding checksum letter in uppercase
ie should return A and should return B
Note: You are strongly encouraged to use comments to describe your code where necessary. Task
Complete the function checksumcalculator plate by putting everything together and returning the
checksum letter in uppercase given a license plate. Reminder: Your program should be able to handle
lowercase inputs. The prefix
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started