Open transactionFile
Read an order file name
while not at the end of transactionFile
Process the order
Read a new order file name
Close the orderfile
The main program will open and process the transaction file, one order at a time until all orders have been processed.
Open the order file
if successful
Process an order
close the file
else
print error message
Open output file Process header Get a line item While there are line items Process line item Get a line item Print the order totals Close the files
Print "Packing Slip" Print Address Print Column Headers
const string ORDER_TITLE = "PACKING SLIP"; const int TOTAL_WIDTH = 80; ... cout << setw(TOTAL_WIDTH/2-ORDER_TITLE.lenght()/2) << ORDER_TITLE << endl ;
Read the first name from the input file Read the last name from the input file Print firstName + " " + lastname right justified to output file Read first address line Print first address line to output file. Read second address line If the second address line is not a blank, print the second address line. PrintStateCityZip
Read in item number, quantity, weight and size. Calculate total weight Add to total items, grand total weight and the proper volume count Print the line
(Process An Item, new algorithm)
Initialize totals
Open output file
Process header
Get a line item
While there are line items
Process line item
Get a line item
Print the order totals
Close the files
ProcessLineItem (revised)
Calculate total weight
Add to total items, grand total weight and the proper volume count
Print the line