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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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