Overview

For this project you will implement a program that processes files that represents purchase orders. The program can complete the processing by using a single thread or multiple threads.

IMPORTANT: For this project, there are no public or release tests. All tests are secret. You will submit your project as usual, but no testing information will be provided by the submit server. We have provided a simple example to illustrate the input and output format associated with the project. The provided example is not considered a public test.

If you cannot check out the project from your CVS repository, then use the following link to download your project: Project Distribution

Objectives

Grading

Clarifications

Any clarifications or corrections associated with this project will be available at Clarifications.

Code Distribution

The project's code distribution is available by checking out the project named OrdersProcessor. The project distribution has the following files/folders:

Specifications

Data Manager

Your program will process a set of files, each representing a purchase order. Each file has information about items associated with a purchase order. The possible items that can be purchased can be found in the file itemsData.txt. The program will compute a summary for each order (file) that provides the client id, and a sorted list (by item's name) of each item bought. The list will include the cost per item, the quantity of items bought, and the total cost associated with the item's purchase. After the sorted list, a grand total will be displayed. See the resultsExample.txt file for an example of the data format. In addition to the above report, the program will generate a summary of all orders. The summary will display a sorted list (by item's name) providing information about the total number of items sold, and total revenue (see resultsExample.txt.)

Your program will allow users to process all the orders using a single thread or one thread per order (file). For simplicity, all the orders will use the same base filename (e.g., example in the files above.) The user will provide a filename for the results.

In order to see the advantages of threading, your program needs to print (to standard output) the time (in msec) it took to process orders. You can compute the time as follows:

long startTime = System.currentTimeMillis();
/* TASK YOU WANT TO TIME */
long endTime = System.currentTimeMillis();
System.out.println("Processing time (msec): " + (endTime - startTime));

Your program will ask users about how to configure a particular program run using standard input and output. The following represents a run that computed the results you see in resultsExample.txt. Code in italics represents user's input.

Enter 'y' for multiple threads, any other character otherwise: y
Enter number of orders to process: 2
Enter order's base filename: example
Enter result's filename: resultsExample.txt
Reading order for client with id: 1
Reading order for client with id: 2
Processing time (msec): 106
Results can be found in the file: resultsExample.txt    

Requirements

Additional Requirements for Students in CMSC 132H (Honors)

Students in the honors section may need to complete this part. Talk to your instructor to verify if this is the case.

In addition to the above requirements, you must define a program that generates files with random data (similar to example1.txt.) We should be able to provide a number of files, a maximum number of entries per file and your program should generate files with a random number of entries (not exceeding the specified maximum.) Call your program DataFilesGenerator.java.

Web Accessibility