Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use beginner level java coding on the ding (10 pts) Problem 2 certain rules Credit card numbers are not completely uenoes; t are doubltom the

Use beginner level java coding image text in transcribed
image text in transcribed
on the ding (10 pts) Problem 2 certain rules Credit card numbers are not completely uenoes; t are doubltom the second digit. This means the 2nd, 4th, not doubled (ie, the Ist, 3rd, 5th, card issuer. For example, an American Express TRX scientist or 37, and satisty the Luhn formula (created by card pumber must be 15 digts thecres card mumber must be 15 digits in lehe 1950s) When applied to an AmEx cand mumber, here's bow th Double the value of every other digit, starting 6th, 8th, 10th, 12th, and 14th digits are doubled. cod digit. Far each of the doubled values that exceed 9, subtract 9 Ad up all the doubled values,along with the digits that were and so on digits). Ithe resule is a multiple of 10, the number is valid. If the result is not a is invalid Por example 372947128748052 is a d AmEx card number. (Don't worry, this and most likely doesn't actually belong to anyone :) You can long and begins with 34 or 37. To check whether it satisfies the Luhn form easily verify that the number is 15 digits Original number: 3 729 471 2874 8 o 5 2 ula: Double every second digit: 3 14 218 4 141 4 8 14 416 010 2 For every doubled value that exceeds 9, subtract 9: ty, add up the remaining digits: 3+5+2+9+4+5+1+4+8+5+4+7+0+1+2 60, which is indeed a multiple of 10. Now that you know how to validate an AmEx card mumber, it isn't hard to generate Here's an algorithm to do so: 1. Randomly pick 34 or 37 as the first two digits 2. Randomly generate the next 12 digits; each one is between 0-9. 3. Pick the last digit to make the number satisfy the Luhn formula. valid numbers. For suppose that you've picked 34 as the first two digita, followed by 43535006754 as the nest Ca the last digit z. To pick a such that the number satisfies the Luhn formula, procea follows: The number so far Double every second digit: For every doubled value that exceeds 9, subtract 9 3 846 565O03 7 148x Adding up all the digits gives 60 + z. Remember that you want the final sum to be a multiple of 10, so you should pick a value of z between 0-9 such that 60-+ is divisible by 10. Clearly, z 0 satis So, the final valid AmEx number is 344353500675440. Within your Labs folder, write a program named AmExNumberGenerator java that aaks the user for how many AmEx card numbers s/he wants, and then uses page to produce the generation algorithm at the top of this numbers are valid, and show the numbers on the screen. To verify that your gener or.html can use https://www.freeformatter.com/credit-card-number-generator-validat AmEx numbers Side note: This lab probably seems awfully shady, but keep in mind that having valid oesn't mean much by itself. First, the total number of possible valid AmEx card numbers is 2 x 1012 (2 trillion), which is far beyond the number of active AmEx accounts in the world. So it's unlikely that a randomly generated number actually belongs to anyone. Second, on the off chance that you produce someone's real card number, it's not usable without additional personal information and the security code printed on the physical card. Here's an example of what your completed program might look like when you run it. Underlined parts indicate what you type in as the program is running. How many AmEx numbers vould you like to generate? Here you go, have fun: 373882560109944 346658810131142 379864135018507 345036033329317 348527636606793

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Show the properties and structure of allotropes of carbon.

Answered: 1 week ago