Note: Because of the holidays, anything turned in by 11:59 pm on Monday, December 1, will count as only one day late.
hw7-delete.c
hw7-inv.c
.
These programs are to be electronically submitted by using the submit program on csa. The code you submit should conform with the program assignment guidelines.
/* Function: DeleteKeyFromSymbolTable * Usage: value = DeleteKeyFromSymbolTable(table, key); * ------------------------------------------------------- * This removes key (and it associated value) from table, returning * the value associated with key or UNDEFINED if key is not in table. */ void *DeleteKeyFromSymbolTable(symtabADT table, string key);
To save space on the system and in the grader's files, please submit just the implementation of this one function in hw7-delete.c. Here are some files you might want to look at:
A - Add item
D - Delete item
L - Lookup item
I - print Inventory list
< - print Inventory list for items with quantity less than specified amount
X - print most expensive item (with price and quantity)
Q - quit
Some of these take additional input (in order listed): A (item, price, quantity), D (item), L (item), < (quantity). Each operation which prints one or more items should give the item followed by price, followed by quantity in nice columns. (You may print only the first 15 characters of an item with a long name.) The order in which items are printed (when more than one is printed) is irrelevant and will probably be in some "random" order which depends on the hash function used. If the user tries to lookup something not in the table, an appropriate message should be displayed.
Input/Output. Each input value should be requested on a separate line. This will make your lives easiest, since you will not need to parse the input. You may read the commands as strings and then just look at the first character. (I will not require that you program handle inputs of more than one character, but this is an easy method to do so.) Thus a sample run might look like:
command (A,D,L,I,X,<,Q): A
item: hammer
price: 7.50
quantity: 10
command (A,D,L,I,X,<,Q): D
item: nails
nails not present in table. Nothing deleted.
command (A,D,L,I,X,<,Q): I
Current Inventory
======= =========
item price quantity
---- ----- --------
hammer 7.50 10
command (A,D,L,I,X,<,Q): Q
You may adjust the format of the output as ong as it is easy to
read and presents the appropriate information.
If you do not implement all of the commands, be sure you
still ask for all of the requested inputs and print a message
to the effect that the command has not been implemented.
Makefile.
Makefile.a7,
you will have to use the mv (short for move)
command to rename it by typing
mv Makefile.a7 Makefile
cp command to copy it by typing
cp Makefile.a7 Makefile
make -k. (The -k means "keep going", which instructs
make to build as much as it can, rather than quit after the first error.)
Do not allow your work to be used by others:
Warning: If someone cheats by using your work, you will also be penalized.