Data
Structures and Algorithms INote: The CreditParameters.h file was updaed Feb 1. If you are getting link errors for symbols that are already defined, this will fix it. Just copy the CreditParameters.h file (you will eed to extract it from the archive below) over top of the one you downloaded earlier and rebuild all. Sorry for the problem.
Develop a program that keeps track of credit card accounts. Data for existing accounts will be read from a file. This information is to be stored in objects of type CreditAccount. You will need an array of these. There is a limit of 25 accounts in this array. Attempts to hold more accounts will cause an error message, and the additional accounts will not be stored.
A transaction file will then be processed. This file will contain a sequence of transactions (no limit on the number of transactions). Each transaction is to be read into a Transaction object and then applied to the appropriate account. After all the transactions are processed, the account data is written to a new file using the same format as the original file.
The name of the input file is to be entered by the user. The program must append ".crd.txt" to the end of the specified name and then attempt to open the file. Allow the user up to four chances to get the file name correct, then terminate the program if necessary. The credit account file contains one account on each line and will be formatted as follows:
account number: 16 characters
cardholder name: 25 characters, leading blanks if needed
balance: a number (floating point with 2 decimal places)
The user must enter the name of the transaction file (append ".trn.txt") according to the same rules for the account file (four tries). The transaction file has one transaction per line, formatted as follows:
account number: 16 characters
transaction code: a character (N, C, T, P, or D)
transaction data: depends on transaction code:
N: cardholder name (new account, balance 0)
C: a number (amount of a charge)
T: a number (amount of balance transfer)
P: a number (amount of a payment)
D: no additional data (delete account but only if balance is 0)
As each transaction is processed, a transaction message should be written to a log file (use the transaction file name base and append ".log.txt"). You should overwrite existing log files. The result of each transaction should be clearly displayed. The log file should end with a summary of all the accounts after the transactions have been processed (account number, cardholder name, original balance, total charges (including balance transfers), total payments, total fees (for balance transfers), and the new balance).
The updated account information should be written to a file with the same base name as the original account file. Substitute ".crd.new.txt" as the file extension. Overwrite existing files of the same name. Use the same internal format.
Create a class to manage the list of accounts. Accounts should be maintained in sorted order (by account number) and a binary search used to find an account when it needs to be updated. You must implement the sort using the insertion sort algorithm. You should not assume that the account file is sorted.
Balance transfers are always charged 3% of the transfer amount, however there is a minimum charge of $5.00 and a maximum of $45.00.
Sample data files and project shell are available here.
Required classes: CreditAccount, Transaction, AccountList. Use a separate header and source file for each class.
Submit your completed project to margush@uakron.edu as a zipped attachment to an email with subject line DSA1 Program 1 - Fred Jones (substitute your name). The zip file must be named with your last name and the digit 1 attached to the end (Fred Jones would submit a file named Jones1.zip). The zip file must unzip to create a folder with the same name (Jones1) and the folder must contain all of the project files needed to open the workspace and build the project. Please erase the Debug folder before zipping. Note - you can see how the download file unzips (p1.zip will unzip into a folder named p1 and that will contain a project). After unzipping, you should immediately rename the folder with your last name and the 1 (Jones1) - this will make the zipping easy.