Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include int isValidCC(unsigned long long int CCNumber); int main() { unsigned long long int CCNumbers[] = { 4388576018410707ULL, // valid 4388576018402626ULL, // invalid 7388576018402686ULL, //

#include

int isValidCC(unsigned long long int CCNumber);

int main()

{

unsigned long long int CCNumbers[] = {

4388576018410707ULL, // valid

4388576018402626ULL, // invalid

7388576018402686ULL, // invalid

438857601810707ULL, // invalid

4012888888881881ULL // valid

};

for (int i = 0; i < sizeof(CCNumbers) / sizeof(CCNumbers[0]); i++)

{

if (isValidCC(CCNumbers[i]))

{

printf("%llu is a valid Visa number. ", CCNumbers[i]);

}

else

{

printf("%llu is not a valid Visa number. ", CCNumbers[i]);

}

}

}

int isValidCC(unsigned long long int CCNumber)

{

// TO DO

}

Use one of the files above as a starting point. Only implement the isValidCC function. You do not need to change any other code. Other credit card numbers will be used to verify the function works correctly.

For this project, you will implement a function that validates Visa credit card numbers. The function will take an unsigned long long int and return an int (or bool). A file is provided for you to complete. You only need to implement the function. You must match the function prototype given. You will receive a 0 if your function implementation does not match the given prototype. Do not add any global variables.

A valid Visa credit card has the following properties:

  • starts with a 4
  • is 16 digits long
  • the Luhn algorithm results in a value that is a multiple of 10 (value % 10 = 0)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions