Question: Description This program reads an input file containing credit card information and detemines if the card numbers and expiration dates are valid. A card number

Description
This program reads an input file containing credit card information and detemines if the card numbers and expiration dates are valid. A card number consists of digits 0 through 9 and uppercase letters and is valid if it follows these rules:
Has a length of exactly 12 characters.
The first character is the letter 'A','C', or 'E'.
The sum of the digits, when divided by 5, leaves a remainder of 0(i.e., sum %5 equals 0).
A card is considered expired if its expiration date is earlier than the current date (i.e., month and year). If the card's year is earlier than the current year, the card is no longer valid. If the card's year is the same as the current year, the months are compared. The card is considered invalid if its month is earlier than the current month. Overall, a card is considered "Valid" if both the credit card number and expiration date are valid.
The program will read the credit card information from an input file. As it reads a record, determine if the card number is valid and if the card expiration date is valid. The program also counts the number of records in the input file, and how many of those cards were valid and invalid:
Input: All input is in a file named
CardNumbers.py. It contains a series of records, and each record has 2 pieces of data:
Credit card number (a string of uppercase letters and digits)
Expiration date (string that uses two digits for the month and four digits for the year, separated by a forward slash: MMYYYY)
The input file is of unknown length and ends when the card number is # # # (i.e., the sentinel value ).
Description This program reads an input file

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!