#include <stdio.h>
#include <ctype.h>
int irishLicensePlateValidator(int year, int halfYear, char county, int sequenceNumber);
int main(void) {
// your code goes here
int result = irishLicensePlateValidator(13, 2,'c',00000000124);
}
int irishLicensePlateValidator(int year, int halfYear, char county, int sequenceNumber)
{
// you can get most all values you need from the parameter values passed in
//year: check if they are between 2013-2024. if yes take only the last 2 numbers
// halfYear: check if it's 1 or 2
//county: accept 'C' or 'c' for "Cork", 'D' or 'd' for "Dublin", 'G' or 'g' for "Galway", 'L' or 'l' for "Limerick", 'T' or 't'
// for "Tiperary", and 'W' or 'w' for "Waterford".
// sequenceNumber: check that it doesn't start w 0, its all numbers, and its 6 or less digits
// add some conditional statement logic to check each parameter (switches, if/else, ...)
if (!(year >= 13 && year <= 24)) //check if year is
{
return 0;
}
if (!(halfYear == 1 || halfYear == 2))
{
return 0;
}
{
case 'C':
case 'D':
case 'G':
case 'L':
case 'T':
case 'W':
break;
default:
return 0;
} // switch
if (!(sequenceNumber >= 1 && sequenceNumber <= 999999))
{
return 0;
}
return 1;
// return either 1 or 0 ... for T/F
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxjdHlwZS5oPgppbnQgaXJpc2hMaWNlbnNlUGxhdGVWYWxpZGF0b3IoaW50IHllYXIsIGludCBoYWxmWWVhciwgY2hhciBjb3VudHksIGludCBzZXF1ZW5jZU51bWJlcik7CgppbnQgbWFpbih2b2lkKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCgkKCWludCByZXN1bHQgPSBpcmlzaExpY2Vuc2VQbGF0ZVZhbGlkYXRvcigxMywgMiwnYycsMDAwMDAwMDAxMjQpOwoJcHJpbnRmICgiJWQiLCByZXN1bHQpOwp9CgppbnQgaXJpc2hMaWNlbnNlUGxhdGVWYWxpZGF0b3IoaW50IHllYXIsIGludCBoYWxmWWVhciwgY2hhciBjb3VudHksIGludCBzZXF1ZW5jZU51bWJlcikKewoKICAgIC8vIHlvdSBjYW4gZ2V0IG1vc3QgY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6CiAgICAgICAgICAgIGNhc2UgJ0cnOgogICAgICAgICAgICBjYXNlICdMJzoKICAgICAgICAgICAgY2FzZSAnVCc6CiAgICAgICAgICAgIGNhc2UgJ1cnOgogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICByZXR1cm4gMDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgIH0gLy8gc3dpdGNoCiAgICBpZiAoIShzZXF1ZW5jZU51bWJlciA+PSAxICYmIHNlcXVlbmNlTnVtYmVyIDw9IDk5OTk5OSkpCiAgICAgICAgewogICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9CiAgICByZXR1cm4gMTsgICAgCiAgICAvLyByZXR1cm4gZWl0aGVyIDEgb3IgMCAuLi4gZm9yIFQvRgoKfQ==