Title: Programming Assignment 1: DVD Inventory Management System
1Programming Assignment 1 DVD Inventory
Management System
- Chien Chin Chen
- Department of Information Management
- National Taiwan University
2Task
- The goal of this programming project is to
implement a DVD inventory management system. - You are asked to write a C program that
implements the DVD inventory management system as
described in the textbook, pp. 221-227. - With some modifications.
3System Requirements (1/4)
- Define an ADT inventory. (you may want to use the
data structures as suggested in Figure 4-33) - The inventory consists of a list of movie titles.
- Each movie title has the following information
- Title.
- Have value number of DVDs currently in stock.
- Want value number of DVDs that should be in
stock. - Wait list list of names of people waiting for
the title if it is sold out. - Example
- Title StarWar.
- Have value 3.
- Want value 6.
- Wait list Eric, John, and Mary.
4System Requirements (2/4)
- MUST use (write) a linked list to store the move
titles in your program. - Additionally, MUST use (write) another type of
linked lists to store the wait lists of move
titles.
title list
titlei have4 want 6
titlej have3 want 2
john
Wait list
Amy
5System Requirements (3/4)
- Maintain the inventory in ALPHABETICAL order
(ascending) by title. - Use sequential search for finding an inventory
item associated with a title. - When a title is sold out, you must add new names
to the end of a titles wait list. - First-in, first out.
6System Requirements (4/4)
- MUST use (write) a linked list to store the
orders of movie titles in your program. - Delete people from the beginning of the wait list
when new DVDs are available (order delivered).
order list
titlei order1
titlej order3
titlei have4 want 6
titlei have5 want 6
john
Amy
Wait list
Wait list
Amy
7Program Input output (1/3)
- Input
- An input file that contains a previously saved
inventory and order information. - A transaction file that contains commands (with
arguments) to inquire or modify the inventory of
the system. - gt inventory_system input_file transaction_file
- Your main program SHOULD receive parameters from
the command line.
int main(int argc, char argv) // arvg1
the string of input_file // argv2 the
string of transaction_file ...
8Program Input output (2/3)
- Output
- A file that contains the updated inventory and
order information. - Filename dvd_inventory.txt
- File format of input_file (or output
dvd_inventory.txt)
Part I DVD inventory
inventory StarWar 3 6 Eric John Mary StarTrek 2
1 BeforeSunset 4 6 Mike Jubilee order StarWar
2 BeforeSunset 1
title, have, want, wait list
title, order quantity
Part II DVD orders
9Program Input output (3/3)
- gt inventory_system input_file transaction_file
- Your program first reads the content in the
input_file to restore the DVD inventory and order
information. - Then, read the commands in the transaction_file
to manage the DVD inventory. - Each line of the transaction_file indicates a
command for the inventory system.
A Matrix 10 S Matrix John Q
Add 10 matrix into the inventory
Sell one Matrix to customer John
transaction_file
Quit and save the inventory, wait lists, and
order information into dvd_inventory.txt
10Commands Arguments (1/2)
H (help) Provide a summary of the available commands.
I lttitlegt (inquire) Display the inventory information for a specified title
L (list) List the entire inventory (in alphabetical order by title)
A lttitlegt ltquantitygt (add) Add a new title to the inventory.
M lttitle_oldgt lttitle_newgt (modify) Modify title string.
O lttitlegt ltquantitygt (order) Generate a purchase order for the specified title.
D (delivery) The ordered titles are delivered.
11Commands Arguments (2/2)
R lttitlegt (return) Make a return of a specified title. (to reduce the have value to the want value)
S lttitlegt ltcustomergt (sell) Sell a title to a customer. If the title is sold out, put the customer on the wait list of the title.
Q (quit) Save the inventory, wait lists, and order information in a file and terminate execution.
12Sample Test Data
- Sample tests can be accessed at
https//datastructure.im.ntu.edu.tw and
https//dsassignment.im.ntu.edu.tw. - Included input files, transaction files, and
correct outputs.
13Submission (1/2)
- A hard copy of a .doc document clearly describing
your design and implementation of the program
(with some important codes if needed) should be
submitted in the class of November 26, 2007. - The assignment submission requirements can be
found at https//datastructure.im.ntu.edu.tw/Homew
ork_Requirements.pdf, - The submission instruction can be found at
https//datastructure.im.ntu.edu.tw/Web_Introducti
on.pdf. - A grading program is also provided for students
reference at https//datastructure.im.ntu.edu.tw/h
ow_to_score_your_program.pdf.
14Submission (2/2)
- The submission websites will be closed at 11pm,
November 25, 2007. Please make sure to submit
your assignment before the deadline. - WARNING Students who copy other's program get
zero point from this assignment and their names
will be made known to the department.
15Useful References
- https//datastructure.im.ntu.edu.tw/
- How to upload the assignment.
- How to program on Linux.
- How to use vi editor.
-
- Teaching assistants
- ???, r96725014_at_ntu.edu.tw
- ???, r96725022_at_ntu.edu.tw
- ???, r96725034_at_ntu.edu.tw