IUP Computer Science
COSC 310    Fall 2006

Project #5
(Credit Card Use Check)
(Due 13 November 2006)

One of the central clearinghouses for personal credit has decided to monitor credit card transactions that it processes for suspicious activity.  This is difficult because of the volume of transactions that can occur; peek processing may involve accepting several hundred transactions per second.  You are to write a program to test the feasibility of doing a simple frequency check which the company regards as an indicator of possible misuse of a credit card.

Here are the particulars:  The clearinghouse wants the check to be done every 15 minutes.  So, they are providing an actual file of transactions from a typical 15-minute period;  the file is named  card-events.txt  it is on the I:\drive in I:\jlwolfe\310  Each line of the file represents a credit card transaction in the form

Credit-card-number  Amount

where the credit-card-number is a 16-digit number with no spaces or hyphens and the amount is a dollar and cents value, for example        1234567890123456  76.44        is a transaction for $76.44

The frequency check is to determine whether the same credit card number has been used more than once in the same 15-minute period.  Normal credit card use makes such frequent use extremely unlikely and so it is regarded as suspicious when it occurs.

The clearinghouse has set forth the following requirements for your program based on recommendations from their systems analyst.
 

  1. Because it is regarded as simplest to find a recurring value in a sorted collection, your program is required to first sort the events from the card-events.txt file.  Further, the sorting must be very fast because the final system would have to run your program every 15 minutes.

  2.  
  3. The sort you use must be a radix sort - one of the fastest known sorting methods.  Obviously, the sort order is based on the credit card numbers.  One of the simplest ways to implement a radix sort is using queues; your program is required to use queues.

  4.  
  5.  For each credit card number that occurs in the events more than once, your program must display the card number, the number of times it was used and the total amount that was charged in these uses.  This display should be sent to the console window.  Even though the file is likely to contain tens of thousands of credit card transactions; very few should need to be reported.

 
 

In case you are not familiar with a radix sort (sometimes called a bin sort), here is an explanation of how it works.  Start with all transactions in a really long queue.  The key (value that is the basis for the sorting order) is examined one character at a time, starting with the last character, ending with the first.  Bins (queues) are set up for each possible value of the character.  As each transaction's key is examined, the entry is added to the appropriate bin (the order in the bin must be consistent with the order in which the keys are examined).  This activity is referred to as a "distribution."  After all entries (transactions) have been distributed to bins, they are collected into a single queue that is formed by moving the the entries from the smallest character bin to the combined queue.  (The smallest character bin is the one used for entries whose character value is smallest.).  Then the entries from the second smallest character bin are added to the combined queue and so on until all bins have had their entries added to the combined queue.  This is referred to as a "collection."  The sort is accomplished by doing a distribution and then a collection for each character position in the key.

My requirement:
    Your program must use the Java API Queue interface and the LinkedList implementation of it.  Only methods specified in the Queue interface may be used in manipulating the queues; that is, offer, remove, poll, peek, and element.

Make a Project 5 folder in the folder named after you on the P: drive and put your .java files for this program into it.  Hand in a printout of your well documented program and a printout of the display you produced in the console window - copy and paste into NotePad and print.