Eachd "activity" your program is to process will appear as a separate line in the input file. Then end of the input is marked by a line containing an asterisk in column one; no other activity lines will be so marked. Activity lines begin with a lower-case keyword identifying he action to be performed. The names of the items in her inventory are case sensitive, and each contains no more than ten non-blank characters. All fields in the activity lines are separated by blanks, and Madam Phoenix guarantees you that there will be no errors in the input. Here are the various types of activity lines your program is to process.
new item-name item-cost item-selling-price
item-cost
and item-selling-price
are given as normal dollar amounts,
without the dollar sign. That is, they will contain one or
more decimal digits, a decimal point, and two more decimal
digits. Note that this activity line doesn't actually result in a
change n the inventory, but is used in anticipation of adding
units of the new item to the store's offerings. item-cost
is
what Madam phoenix pays for each unit of the item, and
item-selling-price
is the price for which she sells the
item. There will be no more than 100 total item-names ever
included in the the list of items. item-cost
and item-selling-price
will never be larger than 100.00.
delete item-name
item-name
in the inventory are written
off as a loss.
buy item-name quantity
unit-cost
,
previously indicated) of an item-name
to offer for sale,
she'll indicate that with one of these lines in the program
input. quantity
indicates the number of units she
purchased. The quantity she purchases will never be
larger than 5000 at a time, but the number of units in the
inventory may be as large as 10,000.
sell item-name quantity
quantity
indicates the number of units sold (at the item-selling-price
previously indicated). Obviously, the quantity
sold cannot exceed the number of items in stock.
report
delete
activity). The sample output
shown illustrates the desired format for the report. All
numbers in the report must naturally be exact.
Sample Input
new Shade01 0.50 3.79 new Towel01 1.47 6.98 new Shade02 0.63 4.29 new BluBlock 1.00 4.98 buy BluBlock 100 sell BluBlock 2 buy Towel01 500 buy Shade01 100 buy Shade02 100 sell Towel01 1 sell Towel01 1 sell BluBlock 2 report delete Shade01 sell BluBlock 5 new Shade03 0.51 1.98 buy Shade03 250 sell Towel01 5 sell Shade03 4 sell Shade02 10 report *
INVENTORY REPORT Item Name Buy At Sell At On Hand Value --------- ------ ------- ------- ----- BluBlock 1.00 4.98 96 96.00 Shade01 0.50 3.79 100 50.00 Shade02 0.63 4.29 100 63.00 Towel01 1.47 6.98 498 732.06 ------------------------ Total value of inventory 941.06 Profit since last report 26.94 INVENTORY REPORT Item Name Buy At Sell At On Hand Value --------- ------ ------- ------- ----- BluBlock 1.00 4.98 91 91.00 Shade02 0.63 4.29 90 56.70 Shade03 0.51 1.98 246 125.46 Towel01 1.47 6.98 493 724.71 ------------------------ Total value of inventory 997.87 Profit since last report 39.93
new Shade01 0.50 3.79 new Towel01 1.47 6.98 new Shade02 0.63 4.29 new BluBlock 1.00 4.98 buy BluBlock 100 sell BluBlock 2 buy Towel01 500 buy Shade01 100 buy Shade02 150 buy Shade01 25 sell Towel01 1 sell Shade02 15 sell Towel01 1 sell BluBlock 2 sell Shade01 2 sell Towel01 20 report delete Shade01 sell BluBlock 5 new Shade03 0.51 1.98 buy Shade03 250 sell Towel01 5 sell Shade03 4 sell Shade02 10 report new Towel02 1.93 9.95 buy Towel02 100 sell Shade03 10 buy Shade03 20 buy Shade02 5 sell Towel01 3 sell Towel02 1 delete Towel02 report *
INVENTORY REPORT Item Name Buy At Sell At On Hand Value --------- ------ ------- ------- ----- BluBlock 1.00 4.98 96 96.00 Shade01 0.50 3.79 123 61.50 Shade02 0.63 4.29 135 85.05 Towel01 1.47 6.98 478 702.66 ------------------------ Total value of inventory 945.21 Profit since last report 198.62 INVENTORY REPORT Item Name Buy At Sell At On Hand Value --------- ------ ------- ------- ----- BluBlock 1.00 4.98 91 91.00 Shade02 0.63 4.29 125 78.75 Shade03 0.51 1.98 246 125.46 Towel01 1.47 6.98 473 695.31 ------------------------ Total value of inventory 990.52 Profit since last report 28.43 INVENTORY REPORT Item Name Buy At Sell At On Hand Value --------- ------ ------- ------- ----- BluBlock 1.00 4.98 91 91.00 Shade02 0.63 4.29 130 81.90 Shade03 0.51 1.98 256 130.56 Towel01 1.47 6.98 470 690.90 ------------------------ Total value of inventory 994.36 Profit since last report -151.82