A you need to read the card number as a single string and


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. There are two other requirements that make this problem unique:

A) You need to read the card number as a single string and each 4 numbers in the card must be separated by a space. For example, following is a correct input 1234 5678 6789 1235

B) Card number must have 16 digits. If not, display the error message "incorrect card number"

Solution Preview :

Prepared by a verified Expert
Business Management: A you need to read the card number as a single string and
Reference No:- TGS01677544

Now Priced at $20 (50% Discount)

Recommended (92%)

Rated (4.4/5)