Write a program which checks each credit card number

Assignment Help JAVA Programming
Reference no: EM132081082

You need help writing this program in JAVA, this is an introductory java course, so if possible, keep it as basic/simple as possible while still following the instructions. The output should look like the sample execution at the end of the problem.

You have been hired by a credit card company to test their software which generates credit card numbers for new members.

The software produces a text file with a bunch of generated credit card numbers. Your task is to write a program which checks each credit card number in the file and determines whether or not the card number is valid.

Credit card numbers follow a certain pattern. The number must have between 13 and 16 digits. The number must start with:

4 for Visa Cards

5 for Master Cards

34 or 37 for American Express cards

6 for Discover Card cards

An algorithm exists to determine whether or not a card number is valid. The algorithm is as follows: (for this example we will use the card number 4388576018402626)

1. Double every second digit from right to left. If doubling of a digit results in a two-digit number, add up the two digits to get a single-digit number.
    4388576018402626
    2 * 2 = 4
    2 * 2 = 4
    4 * 2 = 8
    1 * 2 = 2
    6 * 2 = 12 (1 + 2 = 3)
    5 * 2 = 10 (1 + 0 = 1)
    8 * 2 = 16 (1 + 6 = 7)
    4 * 2 = 8

2. Now add all single-digit numbers from Step 1.
    4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37

3. Add all digits in the odd places from right to left in the card number.
    4388576018402626
    6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38

4. Sum the results from Step 2 and Step 3.
    37 + 38 = 75

5. If the result from Step 4 is divisible by 10, the card number is valid; otherwise, it is invalid.
    (75 % 10 == 0) //this is false so the card is not valid.

Write a program that uses JFileChooser to allow the user to select the input file of credit card numbers. Process the file by determining which card numbers are valid and which are invalid. Display the results in an output file NOT the console. Your results should have the following format: the card number, company name (if the company can be identified), and whether or not the card was valid or invalid. The following are examples of what your .txt might look like.

Reference no: EM132081082

Questions Cloud

Major ways might this change the external environment : In what major ways might this change the external environment of U.S. businesses?
What is the value of rustenburg share today : Rustenburg Mining Limited just paid a dividend of 400 cents per share. What is the value of Rustenburg's share today? What is the expected dividend yield
Display the total sales in a bar graph for each store : Ask the user to enter the total sales for a chain of stores that you own. The number of stores will vary for each user input.
Prepare a statement of work : MBA41 - Strategic Project Management - Kaplan Business School - You are required to read a case study based on a fictional company and prepare a Statement
Write a program which checks each credit card number : Write a program which checks each credit card number in the file and determines whether or not the card number is valid.
Appropriate to check into potential employee credit history : Explain why it is or why its not appropriate to check into a potential employee's credit history before deciding to hire him or her?
Determine the depreciation for each of the first two years : Determine the depreciation for each of the first two years by the double-declining-balance method. Do not round the double-declining balance rate.
Merge the two groups into a self-directed work team : You have each been chosen to head up your department and merge the two groups into a self-directed work team.
Illustrate the effects of each of the preceding transactions : Illustrate the effects of each of the preceding transactions on the accounts and financial statements of Epic Co. Identify each transaction by date

Reviews

Write a Review

JAVA Programming Questions & Answers

  Draw a scheduling chart to show how the i/o and cpu

Draw a scheduling chart to show how the I/O and CPU are allocated and compute the average turnaround times for the CPU-bound and I/O bound task. Use the following table to keep track of all events and Ready/Blocked (I/O) queues.

  Find the solution of all these java question

find the solution of all these java question

  Report the last letter of each word in the string

Write a sequence of Java statements that report the last letter of each word in the string.

  Create an online storefront that includes a shopping cart

Create an online storefront that includes a shopping cart where customers can make purchases. In addition, here is some code I have put together that may help you with getting a better idea and understanding of the fictitious business that I am cre..

  Cross the dark knight and the living flame of love

What challenges does spain get from the text john of the cross the dark knight and the living flame of love?

  Subtract the immediate constant

Call a procedure at 5120, stacking the return address Subtract the immediate constant 16 from the stack pointer Compare the actual parameter to the immediate constant 4 Jump if equal to 5152

  The program should ask the user to enter the student'' answer

Your program should store these correct answers in an array. (Store each question's correct answer in an element of a string array.) the program should ask the user to enter the student's answers for each of the 20 questions, which should be stored i..

  Find what kind of output best shows off the operation

Find what kind of output best shows off the operation of these classes, and write a program that produces that kind of output.

  Write gui program in java to implement linked list to store

Write a GUI program in Java to implement linked list to store a database of students. Store the student's first and last name, ID number, major, and GPA.

  Write a jsf application that reports the values

Write a JSF application that reports the values of the following system properties of the web server

  What are the events and event handling

What are the Events and Event Handling? Please explain the ActionListener and the actionPerformed methods with am example

  Java method for radix sort in binary

java method for radix sort in binary but I want to understand how to do it so please make it as simple as possible

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd