Homework 5
Hardware Store Inventory

Due: Tuesday, December 5 at 11:59pm

Outcomes

After successfully completing this assignment, you will be able to...

Before Starting

Read Chapters 10 and 11

The Assignment

This assignment is based on Exercise 11.12 on page 474 in the textbook, with a few clarifications and restrictions:

Assumptions and restrictions

Include files

Sample execution

*** Hardware Inventory Program ***

What would you like to do?

Enter
    1  to insert a new item into the datatbase
    2  to list all the tools in the database
    3  to delete an item from the database
    4  to update the information about an item in the database

Type any other number to quit

-->  1
Enter the item number for the new item:  24
What is the name of the item?  Jig saw
How many items are on hand?  21
What is the unit cost?  11.00

What would you like to do?

Enter
    1  to insert a new item into the datatbase
    2  to list all the tools in the database
    3  to delete an item from the database
    4  to update the information about an item in the database

Type any other number to quit

-->  1
Enter the item number for the new item:  3
What is the name of the item?  Electric sander
How many items are on hand?  7
What is the unit cost?  57.98

What would you like to do?

Enter
    1  to insert a new item into the datatbase
    2  to list all the tools in the database
    3  to delete an item from the database
    4  to update the information about an item in the database

Type any other number to quit

-->  2

*** List of Items in the Inventory ***

   3  Electric sander     7  $57.98

  24  Jig saw            21  $11.00

What would you like to do?

Enter
    1  to insert a new item into the datatbase
    2  to list all the tools in the database
    3  to delete an item from the database
    4  to update the information about an item in the database

Type any other number to quit

-->  3
Enter the item number of the item you would like to delete:  3
Item 3 has been deleted.

What would you like to do?

Enter
    1  to insert a new item into the datatbase
    2  to list all the tools in the database
    3  to delete an item from the database
    4  to update the information about an item in the database

Type any other number to quit

-->  2

*** List of Items in the Inventory ***

  24  Jig saw    21  $11.00

What would you like to do?

Enter
    1  to insert a new item into the datatbase
    2  to list all the tools in the database
    3  to delete an item from the database
    4  to update the information about an item in the database

Type any other number to quit

-->  0
Program terminating.

Hints

Get the main program structure working first (i.e., in a loop display the menu and accept the user's response; terminate the program when the user types a number other than 1, 2, 3, or 4). Then, one at a time, implement each of the four operations.

Deliverables

Submit your file using the following turnin command:

/cs/bin/turnin submit cs2301 hw5 hw5.c

Programs submitted after 11:59pm on December 5 will be tagged as late, and will be subject to the late homework policy.

Grading

This assignment will be graded on the following areas: documentation (including pre- and post-conditions for any functions), and correctness. Programs must compile successfully in order to receive points for correctness.