Programming Assignment 1 DVD Inventory Management System Chien

  • Slides: 15
Download presentation
Programming Assignment 1: DVD Inventory Management System Chien Chin Chen Department of Information Management

Programming Assignment 1: DVD Inventory Management System Chien Chin Chen Department of Information Management National Taiwan University

Task o o The goal of this programming project is to implement a DVD

Task o o 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. 221227. n With some modifications. 2

System Requirements (1/4) o Define an ADT inventory. o The inventory consists of a

System Requirements (1/4) o Define an ADT inventory. o The inventory consists of a list of movie titles. (you may want to use the data structures as suggested in Figure 4 -33) n Each movie title has the following information: o o n 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: o o Title: Star. War. Have value: 3. Want value: 6. Wait list: Eric, John, and Mary. 3

System Requirements (2/4) o o MUST use (write) a linked list to store the

System Requirements (2/4) o o 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 have: 4 want: 6 titlej have: 3 want: 2 … Wait list john Amy 4

System Requirements (3/4) o Maintain the inventory in ALPHABETICAL order (ascending) by title. n

System Requirements (3/4) o Maintain the inventory in ALPHABETICAL order (ascending) by title. n o 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 title’s wait list. n First-in, first out. 5

System Requirements (4/4) o MUST use (write) a linked list to store the orders

System Requirements (4/4) o MUST use (write) a linked list to store the orders of movie titles in your program. order list … o titlei order: 1 titlej order: 3 Delete people from the beginning of the wait list when new DVDs are available (order delivered). titlei have: 4 want: 6 titlei Amy want: 6 Wait list john have: 5 Amy 6

Program Input & output (1/3) o Input: n n o An input file that

Program Input & output (1/3) o Input: n n o 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. %> inventory_system input_file transaction_file n Your main program SHOULD receive parameters from the command line. int main(int argc, char * argv[]) { // arvg[1] = the string of input_file // argv[2] = the string of transaction_file. . . } 7

Program Input & output (2/3) o Output: n A file that contains the updated

Program Input & output (2/3) o Output: n A file that contains the updated inventory and order information. o o Filename: dvd_inventory. txt File format of input_file (or output dvd_inventory. txt) inventory Star. War 3 6 Eric John Mary Star. Trek 2 1 Before. Sunset 4 6 Mike Jubilee order Star. War 2 Before. Sunset 1 Part I: DVD inventory title, have, want, wait list title, order quantity Part II: DVD orders 8

Program Input & output (3/3) o %> inventory_system n n input_file transaction_file Your program

Program Input & output (3/3) o %> inventory_system n n 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. o Each line of the transaction_file indicates a command for the inventory system. A Matrix 10 S Matrix John Q transaction_file Add 10 ‘matrix’ into the inventory Sell one ‘Matrix’ to customer John Quit and save the inventory, wait lists, and order information into dvd_inventory. txt 9

Commands & Arguments (1/2) o Commands: H (help) Provide a summary of the available

Commands & Arguments (1/2) o Commands: H (help) Provide a summary of the available commands. I <title> (inquire) Display the inventory information for a specified title L (list) List the entire inventory (in alphabetical order by title) A <title> <quantity> (add) Add a new title to the inventory. M <title_old> <title_new> (modify) Modify title string. O <title> <quantity> (order) Generate a purchase order for the specified title. D (delivery) The ordered titles are delivered. 10

Commands & Arguments (2/2) R <title> S <title> <customer> Q (return) Make a return

Commands & Arguments (2/2) R <title> S <title> <customer> Q (return) Make a return of a specified title. (to reduce the have value to the want value) (sell) Sell a title to a customer. If the title is sold out, put the customer on the wait list of the title. (quit) Save the inventory, wait lists, and order information in a file and terminate execution. 11

Sample Test Data o Sample tests can be accessed at https: //datastructure. im. ntu.

Sample Test Data o Sample tests can be accessed at https: //datastructure. im. ntu. edu. tw and https: //dsassignment. im. ntu. edu. tw. n Included: input files, transaction files, and correct outputs. 12

Submission (1/2) o o A hard copy of a. document clearly describing your design

Submission (1/2) o o A hard copy of a. 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/Homework_Requirements. pdf, The submission instruction can be found at https: //datastructure. im. ntu. edu. tw/Web_Introduction. pdf. A grading program is also provided for students’ reference at https: //datastructure. im. ntu. edu. tw/how_to_score_your_progr am. pdf. 13

Submission (2/2) o o The submission websites will be closed at 11 pm, November

Submission (2/2) o o The submission websites will be closed at 11 pm, 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. 14

Useful References o https: //datastructure. im. ntu. edu. tw/ n n o How to

Useful References o https: //datastructure. im. ntu. edu. tw/ n n o How to upload the assignment. How to program on Linux. How to use vi editor. … Teaching assistants: n n n 宋雲喬, r 96725014@ntu. edu. tw 吳昌桓, r 96725022@ntu. edu. tw 林昕彥, r 96725034@ntu. edu. tw 15