8.5 Exercise 7: Average Orders per Day
|
|
Write a Java application that:
-
Accepts a name of a text file from the command-line
-
Opens this file and processes the order information held in the file to
produce the total value of the orders for each day and the average value
of the orders per day.
-
Displays the calculated values in a report like fashion (see below).
The input text file lists order information. Each line consists of three
values: the order number, the order date, the total value of the order.
Below is a sample file:
1 24/1/1998 $234.78
2 24/1/1998 $12.89
3 24/1/1998 $89.45
4 25/1/1998 $10.78
5 26/1/1998 $123.78
6 26/1/1998 $89.67
7 27/1/1998 $23.10
8 27/1/1998 $23.78
Using this file the application would produce the following output:
Date No. Orders Tot. Value Avg. Value
24/1/1998 3 337.12 112.37
25/1/1998 1 10.78 10.78
26/1/1998 2 213.45 106.73
27/1/1998 2 46.88 23.44