Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question : In Python ,write a program that reads a credit card number from the user. If the user entered a complete card number (e.g.

Question : In Python ,write a program that reads a credit card number from the user. If the user entered a complete card number (e.g. 79927348718) then the program has to validate the card number and print an appropriate message. If the user entered a credit card number that ends with a check digit x (e.g. 7992739871x) then the program should compute x value and display a complete valid credit card number. If the user entered incorrect card number format, your program should display a message to inform the user. See Figure 1 for sample output. A credit card number considered correct if: -

It has exactly 16 digits without any spaces -

It consists of 15 digits and ends with letter x or X -

A card number must NOT have spaces or any other special character (such as !$%^&*()@~# ect) -

A card number must NOT have any alphabet letters (except for x or X at the end representing the check digit)

image text in transcribed

Enter a credit card number: 58965314 Incorrect Card Number Format Enter a credit card number: 9654 3652 1124 3256 Incorrect Card Number Format Enter a credit card number: 1254x56328965412 Incorrect Card Number Format Enter a credit card number: 369852147456t247 Incorrect Card Number Format Enter a cred it card number: 45213@123658%453 Incorrect Card Number Format Enter a credit card number: 4658593086333811 4658593086333011 is valid card Number Enter a credit card number: 46 585938633301X check digit value is: 1 Your full account number is 46 5 8 5 9 386 3 3 3011 Enter a credit card number:4578125432568547 4578125432568547 s invalid credit card Figure Error! No text of specified style in document. 1 Sample Output Assignment#2

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

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions