IN JAVA AND PLEASE DON\'T ANSWER UNLESS U R 100% SURE Final Project Credit card
ID: 3832160 • Letter: I
Question
IN JAVA AND PLEASE DON'T ANSWER UNLESS U R 100% SURE
Final Project Credit card numbers and the case of Mobius Duck In this project, you are assisting an investigation. The investigator asked you to help him determine the validity of credit card numbers located in a case of Mobius Duck, case number 20150510-001. Your task is to Read the data listed below "Data to Evaluate" from a file. Evaluate each number to see if they are representing a possible credit card number. Validate each credit card number to seeifthey are a valid number Store the valid numbers and invalid numbers in a separate amay. Write the contents of validated credit card number array into a file called "valid cards txt". Write the invalid credit card number array to a file called "invalid numbers txt". Make sure to include the issuer for each group of credit card numbers identified. Your application should work with any number of credit card entries. Tum in Source code (java files of all classes and driver class Completed UML for application classes. Flow chart for every method that contains beyond sequential logic flow. Generated javadocs structure. Input and output files Grading Naming standard followed for project files -2% Input and output files-2% Javadoc structure 5% Project compiled without error-91% Proper use of internal comments, docstrings, and tags 5% Self documenting field, identifier, method, static, final, and class identifiers 5% Properly validated input and output files 5% Properly used arrays to store data 5% Correct output calculated by the Luhn algorithm and card number issuer identified-71% Extra Credit: Implement the full Issuer IIN Range instead of the simplified list.Explanation / Answer
import java.util.Scanner; 02 public class CreditCard { 03 public static void main(String[] args) { 04 long total; 05 Scanner input = new Scanner(System.in); 06 System.out.print("Please input your credit card number: "); 07 long number = input.nextLong(); 08 total = sumOfEvenPlaces(number) + sumOfOddPlaces(number); 09 System.out.print(total); 10 if(isValid(total)) { 11 System.out.println("The length of your card number is: " + getSize(number)); 12 System.out.println("This card is valid."); 13 } 14 else { 15 System.out.println("The length of your card number is: " + getSize(number)); 16 System.out.println("Your card is invalid."); 17 } 18 19 } 20 public static boolean isValid(long total) { 21 if (total % 10 == 0) { 22 return true; 23 } 24 return false; 25 } 26 27 public static int sumOfEvenPlaces(long number) { 28 int sum = 0; 29 int remainder; 30 number %= 10; 31 while (number % 10 != 0 || number / 10 != 0) { 32 remainder = (int)(number % 10); 33 sum = sum + getDigit(remainder * 2); 34 number /= 100; 35 } 36 return sum; 37 38 } 39 public static int getDigit(int number) { 40 if (number 9) 43 return (number % 10 + number / 10); 44 45 return number; 46 } 47 48 49 public static int sumOfOddPlaces(long number) { 50 int sum = 0; 51 int remainder; 52 number /= 10; 53 while(number % 10 != 0 || number / 10 != 0) { 54 remainder = (int)(number % 10); 55 sum = sum + getDigit(remainder * 2); 56 number /= 100; 57 } 58 System.out.println(sum); 59 return sum; 60 } 61 62 public static int getSize(long number) { 63 int len = 0; 64 while (number >= 10) { 65 number /= 10; 66 len++; 67 } 68 return len; 69 } 70 71 }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.