Summer 2017

Project: Orders Processor (Concurrency)

Due Date: July 25, 2017 11:59pm
Assignment Type: Closed (See Policy)

Overview

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

For this project there is no CVS repository distribution. The code distribution can be found at OrdersProcessor.zip. Import the project to Eclipse as described in Importing Project. You can download .submit file here.

Objectives

Practice the design and implementation of concurrent systems.

Grading

Clarifications

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

Code Distribution

The project's code distribution has the following files/folders:

Specifications

Processing of Orders (Files)

Your program will process a set of files (e.g., example1.txt) each representing a purchase order. Each file lists the items bought and the date of purchase. The possible items that can be purchased (along with the item's price) can be found in a item's data file (e.g., itemsData.txt). The program you need to write will generate a summary for each order (file). The summary includes the client id and a sorted list (by item's name) of each item bought. The list will include the item's name, the cost per item, the quantity of items bought, and the total cost associated with the item's purchase. After the sorted list, an order's total will be displayed. See the resultsExample.txt file for an example of the data format.

In addition to a report for each order, 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).

Threaded Processing

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));

Driver

Your are free to define any number of classes/interfaces you understand you need, however, you need to provide a class called OrdersProcessor in the processor package. This class can have as many methods as you want, but it must have a main method that allow us to configure/run the processing of orders.

Your program will ask users how to configure a particular processing of orders by using standard input and output. The following represents a run of the OrdersProcessor main method that computed the results you see in resultsExample.txt (code in italics represents user's input).

Enter item's data file name:  itemsData.txt    
Enter 'y' for multiple threads, any other character otherwise: y
Enter number of orders to process: 3
Enter order's base filename: example
Enter result's filename: resultsExample.txt
Reading order for client with id: 1003
Reading order for client with id: 1001
Reading order for client with id: 1002
Processing time (msec): 51
Results can be found in the file: resultsExample.txt

Report

Using the data.zip file, create a table that illustrates the time it takes to process data using a single thread and multiple threads. For example, the table can have three columns where the first indicates the number of orders, the second the time it took using a single thread, and the third the time is took using multiple threads. Provide a brief explanation (no more than a paragraph) of your results. Put your table and explanation in a file named Report.doc you will find in the report package.

Requirements

Web Accessibility