COMP1028: Grocery Store Database - Menu-Driven Program - IT Assignment Help

Download Solution Order New Solution
Assignment Task:

Task:

Objectives: To write a menu-driven program to process structures, arrays, and text files.

Problem Description:
In this assignment you are to write a program that will maintain a small grocery database (i.e., list of structures). The data for each grocery item consists of the item universal product identifier (integer), item name (string), the unit cost (double), and a character indicating the product category (i.e., ‘M’ for meat, ‘P’ for produce, ‘D’ for dairy, ‘C’ for canned goods, and ‘N’ for nonfoods).

 

You must use the following structure for each item:
struct item {
int id;
char name [20];
double cost;
char category;
struct item *next;
};
Your program should first ask the user the name of the text file that contains the data for the database. Then, it should open the file and read its contents into a list of item structures. After the file is opened and the contents are read into the linked list (, close the file and display the following menu:
1. Add new item
2. Delete item
3. Change the cost of an item
4. Search for item
5. Display inventory details
6. Quit

 

Each menu choice should invoke an appropriate function to perform the selected menu item/task. Your program must display the menu after each task and wait for the user to select another option until the user chooses to quit the program.
 

Menu Option 1: Your program should prompt the user for the item’s id number, name, cost and category. The new item must be appended to the end of the database (in memory). Do not allow duplicate items (names nor id) in the database. An item is a duplicate if it's id number matches that of another product already in the database, or if its name is identical to the name of another product in the database. If the user attempts to add a duplicate item, do not add it and print out an error message stating that the item was not added since it was already in stock.

 

Menu Option 2: Your program should prompt the user for the item’s id number. If the id
number is found in the database, your program should delete that element from the list
(of structures) by replacing it with the last record in the database. If the id number is
not found, your program should notify the user.
Menu Option 3: Your program should prompt the user to enter an existing id number. Once the user enters the id number, your program should get the new value for the item’s cost, and update the database accordingly.

Menu Option 4: Your program should prompt the user to enter an item name. If the item name is found in the database, your program should display the contents of that item. Otherwise, it will notify the user that the item is not found in the database.

Menu Option 5: Your program should display the contents of the entire database preferably in tabular/spreadsheet format. The user has the option to have the entire database sorted (either ascending or descending) based on either the item universal product identifier, item name, unit cost or product category.

 

This COMP1028 IT   Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.