Credit card numbers follow a format to quickly determine whether the number is potentially valid. Credit card companies must generate card numbers that match the format. When a cardholder attempts to use their card number, a retailer can check the algorithm. If it is not a valid card number, then the retailer does not need to check any further for authorization. The Prog04 CCNumGenerator Program Banks use the identical first 4 digits for all of their credit cards; these dgits identify the bank that issued the card. You will write a program that will generate a set of valid credit card numbers for a particular bank Step 1: Input. You will prompt the user to enter their 4-digit bank identifier. The user will then be prompted to specify the quantity of valid 16-digit credt card numbers that they would like generated You should prompt the user for input as follows Enter the first four digits of credit card numbers: Enter quantity of eredit card numbers to generate If a user enters an invalid value, the program should notify the user that the value entered is incorrect, and why, and prompt the user to reenter a corrected value. Step2: Calculation. The program will randomly generate the quantity of credit card numbers specified by the user, with the first 4 digits being those provided by the user To generate a valid number, we wll need to 1. Randomly generate the number 2. Test the number generated to make sure that it adheres to the correct credit card format 3. If the number fails the test, we will need to continue to generate another random number unti we find one that satisfies the required format. It may prove useful to break the credit card number into small pieces (e.g.4 numbers of 4 digits, rather than 1 number of 16 digits). The calculations neededtotest the generated number can performed on the smaller pieces and then added together to get the calculation on the full 16 digit credit card number Note: the calculations on the first 4 digits only needs to be calculated once, since it will be the same for every credt card number that we generate . We can use the formula given in class for generating a random number within a range [min,maxj min + (int)(Math.random() ((max- min)+1) A credit card number is valid if step 4 in the following check is confirmed 1. Form the sum of all digits. 2. The result is divisible by 10 For example, consider the number 4012 8888 8888 1882 1. The sum of all digits is 90. 2. 90 s divisible by 10, so the card number is valid Helpful hints Integer division (/) and remainder (%) can be used to isolate dots of an integer number * You may find that you need to repeat similar code multiple times (for example, make validation calculations on the first 4 digits, make the validation calculations on the second 4 digits, etc.). You can do this easily with some keyboard commands. To copy a chunk of code, select it and press the
while pressing the cO key. To paste that same a chunk of code, place your cursor in the baton that you want t pasted to and then press the