Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I will rate right away! The assignment is to write a menu driven program that ma

ID: 3657865 • Letter: I

Question

I will rate right away! The assignment is to write a menu driven program that manages a small business inventory, collection or list. The Menu commands must include: A....Add a new entry D....Delete an item from the list (inventory) P....Display all records (on the screen/monitor) S....Create a current report (save it to a file) C....Clear all records Q...Quit You must add (1) additional menu option that you choose. It may be a menu option that allows the inventory to be modified. i.e. add inventory quantities, change price/cost, change dates, etc. You will use structs and an array to organize the data in the program. Your struct must contain at least the following kinds of information: o Minimum of 2 strings (character arrays) ? Suggestions include: item name, manufacturer, etc o Minimum of 2 integers 1 must be product id ? Product id, qty in stock o Minimum of 2 double values ? Suggestions include: cost, price, average inventory: When you add new item the program will ask the user for each of the fields on a separate line. When you delete an item from inventory the program will ask you for the integer id of the entry to be deleted, locate the entry in the array and remove all of the data for that entry. The list does not need to be sorted to remove an entry, you may move the last item in the list to the location of the deleted entry When you display the records on the screen, all of the information stored for each entry will be labeled and displayed. Creating a current inventory report copies the current entries in the array to an output file. This must include labeling all of the information so that it is clear what information is being provided. Clearing the records deletes all of the information in the array. should look like this Sample output: Hello and welcome. This program helps you create an inventory for skate shoes. To get you started, 5 shoes have already been entered. ****************************************** Please select from the options below: A - ADD a new entry D - DELETE an entry P - PRINT entire catalog S - SAVE the current catalog C - CLEAR entire catalog U - UPDATE the price Q - QUIT What would you like to do: p ----Catalog Entry 1---- BRAND: Globe NAME: Sabaton I.D.#: 101 QTY: 45 COST: $30.00 PRICE: $65.99 ----Catalog Entry 2---- BRAND: Vans NAME: Authentic I.D.#: 102 QTY: 3 COST: $30.00 PRICE: $65.99 ----Catalog Entry 3---- BRAND: Globe NAME: Ease I.D.#: 103 QTY: 14 COST: $20.00 PRICE: $35.99 ----Catalog Entry 4---- BRAND: Vans NAME: Classic I.D.#: 104 QTY: 61 COST: $10.00 PRICE: $15.99 ----Catalog Entry 5---- BRAND: Globe NAME: Focus I.D.#: 105 QTY: 6 COST: $40.00 PRICE: $85.99 ****************************************** Please select from the options below: A - ADD a new entry D - DELETE an entry P - PRINT entire catalog S - SAVE the current catalog C - CLEAR entire catalog U - UPDATE the price Q - QUIT What would you like to do: u Enter the I.D.# of the entry you would like to update: 104 ----Catalog Entry ---- BRAND: Vans NAME: Classic I.D.#: 104 QTY: 61 COST: $10.00 PRICE: $15.99 Please enter the new price: 9.99 ****************************************** Please select from the options below: A - ADD a new entry D - DELETE an entry P - PRINT entire catalog S - SAVE the current catalog C - CLEAR entire catalog U - UPDATE the price Q - QUIT What would you like to do: p ----Catalog Entry 1---- NAME: Sabaton I.D.#: 101 QTY: 45 COST: $30.00 PRICE: $65.99 ----Catalog Entry 2---- NAME: Nomad I.D.#: 102 QTY: 3 COST: $30.00 PRICE: $65.99 ----Catalog Entry 3---- NAME: Ease I.D.#: 103 QTY: 14 COST: $20.00 PRICE: $35.99 ----Catalog Entry 4---- BRAND: Vans NAME: Classic I.D.#: 104 QTY: 61 COST: $10.00 PRICE: $9.99 ----Catalog Entry 5---- NAME: Focus I.D.#: 105 QTY: 6 COST: $40.00 PRICE: $85.99 ****************************************** Please select from the options below: A - ADD a new entry D - DELETE an entry P - PRINT entire catalog S - SAVE the current catalog C - CLEAR entire catalog U - UPDATE the price Q - QUIT What would you like to do: c Your catalog has been cleared of all entries. ****************************************** Please select from the options below: A - ADD a new entry D - DELETE an entry P - PRINT entire catalog S - SAVE the current catalog C - CLEAR entire catalog U - UPDATE the price Q - QUIT What would you like to do: p ***** Catalog is empty ***** ****************************************** Please select from the options below: A - ADD a new entry D - DELETE an entry P - PRINT entire catalog S - SAVE the current catalog C - CLEAR entire catalog U - UPDATE the price Q - QUIT What would you like to do: a Please enter the Brand of the shoe: Globe Please enter the name of the shoe: Encore What is this shoe's I.D. number: 110 What is this shoe's quantity: 33 How much does this shoe cost: 10.00 How much will you charge for this shoe: 19.99 Your entry has been added to the catalog. ****************************************** Please select from the options below: A - ADD a new entry D - DELETE an entry P - PRINT entire catalog S - SAVE the current catalog C - CLEAR entire catalog U - UPDATE the price Q - QUIT What would you like to do: p ----Catalog Entry 1---- BRAND: Globe NAME: Encore I.D.#: 110 QTY: 33 COST: $10.00 PRICE: $19.99 ****************************************** Please select from the options below: A - ADD a new entry D - DELETE an entry P - PRINT entire catalog S - SAVE the current catalog C - CLEAR entire catalog U - UPDATE the price Q - QUIT What would you like to do: q Goodbye. Press any key to continue . . .

Explanation / Answer

1. structs ------------------- typedef struct rec { char item[100]; char manufacturer[100]; int productid; int quantity; double cost; double avg_inventory; }record; This is the structure(coded in C) with the valid fields given 2. As mentioned you will be using an array of such records( called 'inventory'). So you will be maintaining a integer variable index(initial 0) to maintain the current position of array input. When you enter new record you increase the value of index by 1 and remove one record means decreasing the index by 1. Index can be used to access the current empty array position. A. Add new entry. -------------------------- Just create a new record in variable 'temp' and preform, inventory[index] = temp; index++ B. Delete item from inventory ----------------------------------------- Just compare in a loop all records in the array 'inventory' to match with the desired item to delete(use strcmp). When it matched just, copy the last record (i.e inventory[index-1]) into that position and then decrease the index by 1. C. Display all records --------------------------- Just loop through the array( for(ctr=0; ctr 6 functions apart from this you can make smaller functions to take user choice from Menu and Inputting a Record and returning it. That way you can get desired min 8 functions. Also you can use (#define arrsize 25) as mentioned