Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Language is for Java ------ Input ------- credit-cards-2.dat //////////////////// Output//////////// Enter a filename Credit card number: 3056 9309 0259 04 Checksum: 50 Card status:
The Language is for Java
------ Input -------
credit-cards-2.dat
//////////////////// Output////////////
Enter a filename Credit card number: 3056 9309 0259 04 Checksum: 50 Card status: VALID Credit card number: 3852 0000 0232 37 Checksum: 40 Card status: VALID Credit card number: 6011 1111 1111 1117 Checksum: 30 Card status: VALID Credit card number: 6011 0009 9013 9424 Checksum: 50 Card status: VALID Credit card number: 3530 1113 3330 0000 Checksum: 40 Card status: VALID Credit card number: 3566 0020 2036 0505 Checksum: 50 Card status: VALIDWrite a program that reads from a list of credit cards and determines if those cards are valid. Each file provided encodes the credit card numbers are longs. In binary, read each long and process the card. To determine if a credit card is valid, use the following algorithm. From the rightmost digit, which is the check digit, and moving left, double the value of every second digit. The check digit is not doubled; the first digit doubled is immediately to the left of the check digit. If the result of this doubling operation is greater than 9 (e.g., 8 x 2 = 16), then add the digits of the result(e.g., 16: 1 + 6 = 7, 18: 1 + 8 = 9) or, alternatively, the same final result can be found by subtracting 9 from that result (e.g., 16: 16-9 = 7, 18:18 - 9 = 9). Take the sum of all the digits. (Display this to the user) If the total modulo 10 is equal to 0 (if the total ends in zero) then the number is valid. Write a program that reads from a list of credit cards and determines if those cards are valid. Each file provided encodes the credit card numbers are longs. In binary, read each long and process the card. To determine if a credit card is valid, use the following algorithm. From the rightmost digit, which is the check digit, and moving left, double the value of every second digit. The check digit is not doubled; the first digit doubled is immediately to the left of the check digit. If the result of this doubling operation is greater than 9 (e.g., 8 x 2 = 16), then add the digits of the result(e.g., 16: 1 + 6 = 7, 18: 1 + 8 = 9) or, alternatively, the same final result can be found by subtracting 9 from that result (e.g., 16: 16-9 = 7, 18:18 - 9 = 9). Take the sum of all the digits. (Display this to the user) If the total modulo 10 is equal to 0 (if the total ends in zero) then the number is valid
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started