Trigg Industries uses invoices to bill customers for goods purchased. Trigg currently has an order program which takes order information, but it does not produce the invoices required to bill customers.
The billing program does produce an output file with the invoice information, however, it does not total each invoice, and the formatting is not very intuitive for humans to read. the output from the billing program is in the following format:
invoiceno,customerid,itempartno,itemdescription,it emcost,itemquantity
where
invoiceno is the invoice number (an integer )
customerid is the customer number (a string of at most 20 characters)
itempartno is the part number for the item (an integer)
itemdescription is a description of the item (a string of up to 20 characters)
itemcost is the cost of the item (a dollar value)
itemquantity is the number of items ordered.
Your job is to write a program which produces the invoices, with totals, from the input file. The format of the output file is shown in the examples.
Note: The file may contain more than one invoice. Your output file should contain a separation line between each invoice.
An Example input file appears as follows:
--begin sample input--
1234,ABC123,234,Widgets,2.00,101234,ABC123,221,Springs,1.00,201235,CDF45,228,Gears,1.50,10--end sample input--
The output produced from the above should be (the first two lines are shown for
spacing purposes. These are not required in your output):
--begin sample output--12345678901234567890123456789012345678901234567890 12345678901234567890123456789000000000011111111112222222222333333333344444444444 555555555566666666667777777778
--------------------------------------------------------------------------------
Trigg Industries
Invoice: 1234 Customer: ABC123 Date: 10/26/2009
--------------------------------------------------------------------------------
Item No. Description Unit Cost Quantity Subtotal
234 Widgets 2.00 10 20.00
221 Springs 1.00 20 20.00
--------------------------------------------------------------------------------
Total Due: 40.00
--------------------------------------------------------------------------------
Trigg Industries Invoice: 1235 Customer: CDF45 Date: 10/26/2009
--------------------------------------------------------------------------------
Item No. Description Unit Cost Quantity Subtotal
228 Gears 1.50 10 15.00
--------------------------------------------------------------------------------
Total Due: 15.00
--end of sample output
--Use redirection to direct the input from the input file and to direct the output to the output file.