The Luhn algorithm is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Identifier numbers, ... etc. Write a program in (C++/Java) and Python that reads the text file "CreditCards.txt" and validate each credit card number using Luhn algorithm described below. The program should generate a report displaying the following information on the console: Credit Card 4532971700336820 1 2 5163611731527401 Type Visa MasterCard John Smith After implementing the above program, which programing language would you prefer (C++/Java) or Python? Why? 101BANK CREDIT CARD 4137 8947 1175 5904 Expiry Duter 10/19 Checksum 70 41 3789 Step 1: Double the value of every second digit. 167 1698721 14 5 10 9 04 755904 Step 2: If the result of this doubling operation is greater than 9 (e.g. 16), then add the digits of the product (e.g. 1+6=7). 16779872155 90 Step 3: Take the sum of all the digits. 8+1+6+7+7+9+8+7+1+2+5+5+1+9+0+4-80 Step 4: If the total ends in zero, this is a valid card number, If not, it is an invalid card number. 80 ends with a 0 Valid? YES NO Valid Card Number

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Write only one of them Java or C++ code using a file reading (the file is worth below) CreditCard.txt ***I want to solve as soon as possible.
The Luhn algorithm is a simple checksum formula used to validate a variety of identification
numbers, such as credit card numbers, IMEI numbers, National Identifier numbers, ... etc. Write
a program in (C++/Java) and Python that reads the text file "CreditCards.txt" and validate each
credit card number using Luhn algorithm described below. The program should generate a report
displaying the following information on the console:
#
1
2
Credit Card #
4532971700336820
5163611731527401 MasterCard
Туре
Visa
John Smith
CREDIT CARD
4137 8947 1175 5904
Expiry Duter 10/19
After implementing the above program, which programing language would you prefer
(C++/Java) or Python? Why?
101BANK
8 16
Checksum
70
41
4137894711 755904
Step 1: Double the value of every second digit.
2 1 14 5
90
Step 2: If the result of this doubling operation is greater than
9 (e.g. 16), then add the digits of the product (e.g. 1+6=7).
8 1 6 7 7 9 8 7 2 155
Step 3: Take the sum of all the digits.
8+1+6+7+7+9+8+7+1+2+5+5+1+9+0+4-80
Step 4: If the total ends in zero, this is a valid card number,
If not, it is an invalid card number.
80 ends with a
***
0
Valid Card Number
Valid?
YES
NO
4
Transcribed Image Text:The Luhn algorithm is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Identifier numbers, ... etc. Write a program in (C++/Java) and Python that reads the text file "CreditCards.txt" and validate each credit card number using Luhn algorithm described below. The program should generate a report displaying the following information on the console: # 1 2 Credit Card # 4532971700336820 5163611731527401 MasterCard Туре Visa John Smith CREDIT CARD 4137 8947 1175 5904 Expiry Duter 10/19 After implementing the above program, which programing language would you prefer (C++/Java) or Python? Why? 101BANK 8 16 Checksum 70 41 4137894711 755904 Step 1: Double the value of every second digit. 2 1 14 5 90 Step 2: If the result of this doubling operation is greater than 9 (e.g. 16), then add the digits of the product (e.g. 1+6=7). 8 1 6 7 7 9 8 7 2 155 Step 3: Take the sum of all the digits. 8+1+6+7+7+9+8+7+1+2+5+5+1+9+0+4-80 Step 4: If the total ends in zero, this is a valid card number, If not, it is an invalid card number. 80 ends with a *** 0 Valid Card Number Valid? YES NO 4
4532971700336820
5163611731527401
4929334332390080
4716254106887945
5183516105436540
4916427044988005
5167075611319988
4716423236855615
5424376859020191
5164493708708902
Transcribed Image Text:4532971700336820 5163611731527401 4929334332390080 4716254106887945 5183516105436540 4916427044988005 5167075611319988 4716423236855615 5424376859020191 5164493708708902
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education