Reference no: EM132355701
1. Write a program to process an input J?le where data inthe J?le is individual lines of credit card numbers {fake numbers, of course]. Your program must indicate if each credit card number is a valid number based on the J?sllowing criteria:
a. First digit must be either a 3, 4, 5, or 15
b. You mayimust assume that all credit card numbers are 10 digits long (again, these are fake numbers],
and using this assumption, start with the leftmost digit, double every second digit from left to right and
add those values together
For example, iftbe credit card number is: "16612346!
You would add the following: 3+12+2+?+12, which is a total of 4!]
c. Again using the assumption that there are It] digits, starting with the second digit, simply add every
second digit from left to right
For example, iftbe credit card number is: "16612346!
You would add the following: ?+15r+2+4+4, which is a total of lti
d. Sumthe results from step h &c
e. Ifthe result from step e is evenly divisible by ID, then the credit card number is valid. You do NOT lmow how many lines of data are in the file, therefore you must use a sentinel-control loop to process the data. The end oftbe datawill he indicatedby a credit cardnumberof all zeroes. Print a "neat and tidy" table {see sample rim] as you read through the file indicating whether each credit card is valid or invalid based on these criteria.
2. Function Requirements You must have three flmctions for tasks a, h & c listed above. They must each be value-returning functions. There must also he a main? flmction containing your sentinel-control loop. Other functions are allowed.