Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE JAVA Problem 2. (20 points) Credit Card Number Validation: In this problem, your job is to validate a credit card number given by the

USE JAVA

image text in transcribed

Problem 2. (20 points) Credit Card Number Validation: In this problem, your job is to validate a credit card number given by the user as a String. First, remove all the spaces or dashes between the number. (Remember that the number is given as a string.) Then, do the following steps to validate the number: Form the sum of all the digits of the credit card number. Add to that sum every second digit, starting with the second digit from the right. Add the number of digits in the second step that are greater than 4. The result should be divisible by 10. . * . For example, consider the number 4012 8888 8888 1881.The sum of all digits is 89. The sum of the colored digits is 46. There are five colored digits larger than 4, so the result is 89+46+5-140. This final number, 140 is divisible by 10, so the card number is valid. Write a Java program, to create a class for this problem, including a method to check the validity of a given number. Then, write a tester program to test some 16-digits numbers for their validity to be credit card numbers

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

What is conversion?

Answered: 1 week ago

Question

4. Are there any disadvantages?

Answered: 1 week ago

Question

3. What are the main benefits of using more information technology?

Answered: 1 week ago

Question

start to review and develop your employability skills

Answered: 1 week ago