#include <stdio.h>
// **************************************************
// Function: validateIrishLicense
//
// Description: Validates the components of an Irish
// license plate based on the input
// parameters
//
//
// Parameters: year - last two digits of year
// halfYear - 1 for Jan-Jun, 2 for Jul-Dec
// countyCode - a value that represents the
// Irish county
// seqNum - a 1 to 6 digit number
//
// Returns: True: valid (1) or False: invalid (0
//
// ***************************************************
#include <ctype.h> // for topper
int validateIrishLicPlate(int year, int halfYear, char countyCode, int sequenceNumber)
{
int valid = 0; // default the license plate to a false value, for invalid
if (year >= 13 && year <= 24) //validates year (needs to be between 13 and 24, including those years)
if (halfYear == 1 || halfYear == 2) //validates the half-year (should be 1 or 2 to be true)
if (sequenceNumber >= 1 && sequenceNumber <= 999999) //validate seq.# is between 1 and 999999
{
// if we got this far, do a final check for a valid Country Code
// Converting to upper case first allows for less overall checks
{
case 'C': // for Cork county
case 'D': // for Dublin county
case 'G': // for Galway county
case 'L': // for Limerick county
case 'T': // for Tipperary county
case 'W': // for Waterford county
valid = 1; // if county is a valid code, break and continue check
default:
break; // do nothing, valid will remain 0
}
}
return valid; //if license plate passes all checks, plate is valid
}
int main(void) {
// your code goes here
return 0;
}