Please read the entire problem before jumping into the code!
Your hardware store keeps its inventory in a file like this:
328712 Hammer 15.75 33274 Pliers 8.95 1000456 Bolt-cutter 38.99 43234 Screwdriver 8.95 9833321 Fencing 75.00
Each record consists of three components:
328712
). Hamme
r).
15.75
).
The maximum number of items in the inventory list is 100.
When a customers order is scanned at the checkout desk, all that is saved in the customer order file is the part numbers of the items being purchased. e.g.
33274 43234 328712
Write a program (or modify an earlier one) that will read the inventory list into one array, read the customer order file into another array, and then print out the cash register receipt. e.g. for the above data, that print-out should look like this:
Pliers (33274) $9.95 Screwdriver (43234) $8.95 Hammer (328712) $15.75 ------------------------------------ Total $34.65
For each item purchased, there should be printed out: The description of the item, its part number, and its price. Also shown should be the total amount of the purchase. The maximum number of items allowed in a single order is 35. For simplicity, dont worry about purchases of more than one of a given item. (If 2 Pliers were ordered, just enter each one separately.) Format all your currencies in standard format: $XXX.XX, but don't worry about lining up columns. Use the following code to format the numeric output:
cout.precision(2); cout.setf(ios::fixed);
Use good programming methods, including separate functions where appropriate. A copy of
a sample customer order file (scanner.txt
) and inventory file (inventory.txt
)
can
be found in the COMMON area of the FTP site under practicals/p9.
Submit the finished CPP file to the FTP site in its own folder called P9.