Write a java program that reads the card type and the card number and then deter
ID: 3653970 • Letter: W
Question
Write a java program that reads the card type and the card number and then determine if the card number entered is a valid card number.First your program should ask if the credit card is MasterCard or visa card. Then ask the 16 digit credit card number. Then add all the digits in the credit card number and get the modulo 10. If the modulo 10 of the summation of all the digits is zero, then its valid visa card. If the modulo 10 of the summation of all the digits is 1 then its valid MasterCard. Otherwise, the number customer has entered is an invalid card number.Explanation / Answer
import java.util.Scanner; public class Taskone { // Main method public static void main(String[] args) { // Scanner creation Scanner input = new Scanner(System.in); // User input and array size System.out.println(" Enter the number of your credit card: "); long card_number= input.nextLong(); int size= 16; // Array creation long[] array = new long[size]; // Storing card number as array for (int i = 0; iRelated 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.