VS2010 C Binary Tree Transaction Analysis - 57319

Solution Posted by


Rating : (19)A+
Solution Detail
Price: $20.00
Request Description


Write a program that will allow a user to perform analyses of a very large dataset using a binary search tree.


Write an application that will allow a user to search for the details of a customer transaction from a very large dataset of transactions. The user will be allowed to enter a date as well as a customer ID. Your program will return relevant information including the customer name and the amount of that transaction.

You are provided a very large file of data (filename transactions.txt). The text file includes about 200,000 randomized individual transaction reports for one year. Each line includes comma-delimited data with the following data elements:

customerID, transactionAmount, date

A sample data line from the transaction file could be:


with the date universally stored as a 10-character string in the form yyyy-mm-dd. You can assume that the no more than one transaction was made by any one customer on a given date.

A second file is required (filename nameid.txt) in order to associate an actual name to a customer code. A sample line from this file would be:


To manage the transaction data, create a class to store one transaction. Data members will include all data tokens on one line within the file discussed above. Then, utilize the templates capability of the binary search tree class (file binTreeType.h) to create binary search tree of transaction objects. Be sure to overload the operators < and == (cout is optional, and can be removed) to allow the binary search tree class to work properly.The ordering of the binary search tree will be governed by these functions. To determine "less than" between transactions, the ordering will first by by customer code and then further chronologically by date. You also need to be sure to be sure that the searching function in the binary search tree class not only files a node in the tree, but also is set up to overwrite tree data to be returned to the calling routine.

You may choose any data structure you wish (array, linked list, etc.) to manage the second file that associates a name to a customer index. Consider that multiple searchs will be required on these data, so efficiency will be a factor.

Create a class to "wrap" the binary search tree. This class will simply add a layer of abstraction so that the file work, the construction of the tree, and searching can be pushed behind another abstraction layer. This also reduces the size and workload of coding in the main driver.

Your driver program should include a simple interface allowing the user to enter a five-digit customer ID number and a date (precisely in the form yyyy-mm-dd). These two together will define the "key" for needed to extract a given transaction. Output could be a very basic report that could something like the following:

Jane Doe (Customer 54321)
(Tax: $6.00)

Be sure to format the dollar amount to two decimal places. Note also the additional requirements for the date reformatting as well as to include the dollar amount for tax (6.0%).

Be sure also to include a feature that responds to the user appropriately if a given transaction is not found in the data structure.

To aid you in "tokenizing" the data components for a given line of input information, consider using the instructor-provided class: StringTokenizer (files StringTokenizer.h and StringTokenizer.cpp). These offer a toolkit for parsing the data components for comma-delimited lines.




Deliver the following as your final product:

  • Printed cover page with assignment name and your name
  • Printed copy of source code
  • Printed copy of output for at least four program runs using the following test cases:
    1. Customer 54321 for date 2012-02-29
    2. Customer 22915 for date 2012-05-18
    3. Customer 99999 for any date
    4. Any customer code for date 2012-04-31



Solution Description

Analysis of data using binary tree.docx
Analysis of dat...