Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write in C leng. CENG 114 2020-2021 Fall HOMEWORK Due Date: January 7, 2021 until midnight Write a program designed for a vintage clothing

image text in transcribedimage text in transcribedPlease write in C leng.

CENG 114 2020-2021 Fall HOMEWORK Due Date: January 7, 2021 until midnight Write a program designed for a vintage clothing shop. The data about the items is stored in "items.txt" file. Each line of the file includes item ID, item type, decade of the item's production, color of the item and price of the item. Each of these parameters are separated by *?" character. Read the data of each item into an array of item structures. Define an item structure to store itemID, itemType, decade, color, price. Your program will display the following menu continuously until user chooses 10 to exit. 0. Read data from file 1. List all the items 2. Show item information 3. Insert new item 4. Remove an item 5. Update an item 6. Sort items based on decade 7. Sort items based on price 8. Find and display all the items of a specific type 9. Write the last 3 items that were added into "newcomer.txt" 10. Exit Choose the task (0-10): Use functions below: (You may use more functions but not less!) a. readFile(): receives name of the file as a parameter and inputs data into an array of structures and returns the array to the calling function. b. listItems() : receives array of structures and properly prints out all of the item information line by line c. showItem(): receives an array of structures as a parameter and inputs ID of the item from the user. Outputs item information. d. insertItem(): receives array of structures, inputs item data from the user and adds it to the end of the array if that item ID does not exist in the array, otherwise it gives an error message. e. removeltem(): receives an array of structures, inputs item ID from user and removes that item from the array and returns the updated array and its size and gives an appropriate message to the user upon task completion. f. updateItem() receives an array of structures, inputs item ID from user and inputs item data for each of the parameters and updates the item accordingly and returns the updated array and gives an appropriate message to the user upon task completion. g. sortDecade(): receives an array of structures and returns the sorted version of this array based on the decades of item productions, and gives an appropriate message to the user upon task completion h. sortPrice(): receives an array of structures and sorts and returns this array based on the prices of items, and gives an appropriate message to the user upon task completion. i. listType(): receives an array of structures and inputs a type of clothing from the user. Prints out a list of all the items that belong to this category; if there is none give an error message, j. newcomers(): receives an array of structures and writes the last 3 items that were added into the array (last 3 elements of the array) to "newcomer.txt". 6 items (1) - Notepad File Edit Format View Help | 19/earrings/20/gold/25.00 25/skirt/60/pink/34.99 13/pants/80/brown/52.50 32/shoes/70/green/40.00 24/ shirt/90/black/32.79 68/tshirt/50/white/9.99 47/shoes/80/teal/35.70 CENG 114 2020-2021 Fall HOMEWORK Due Date: January 7, 2021 until midnight Write a program designed for a vintage clothing shop. The data about the items is stored in "items.txt" file. Each line of the file includes item ID, item type, decade of the item's production, color of the item and price of the item. Each of these parameters are separated by *?" character. Read the data of each item into an array of item structures. Define an item structure to store itemID, itemType, decade, color, price. Your program will display the following menu continuously until user chooses 10 to exit. 0. Read data from file 1. List all the items 2. Show item information 3. Insert new item 4. Remove an item 5. Update an item 6. Sort items based on decade 7. Sort items based on price 8. Find and display all the items of a specific type 9. Write the last 3 items that were added into "newcomer.txt" 10. Exit Choose the task (0-10): Use functions below: (You may use more functions but not less!) a. readFile(): receives name of the file as a parameter and inputs data into an array of structures and returns the array to the calling function. b. listItems() : receives array of structures and properly prints out all of the item information line by line c. showItem(): receives an array of structures as a parameter and inputs ID of the item from the user. Outputs item information. d. insertItem(): receives array of structures, inputs item data from the user and adds it to the end of the array if that item ID does not exist in the array, otherwise it gives an error message. e. removeltem(): receives an array of structures, inputs item ID from user and removes that item from the array and returns the updated array and its size and gives an appropriate message to the user upon task completion. f. updateItem() receives an array of structures, inputs item ID from user and inputs item data for each of the parameters and updates the item accordingly and returns the updated array and gives an appropriate message to the user upon task completion. g. sortDecade(): receives an array of structures and returns the sorted version of this array based on the decades of item productions, and gives an appropriate message to the user upon task completion h. sortPrice(): receives an array of structures and sorts and returns this array based on the prices of items, and gives an appropriate message to the user upon task completion. i. listType(): receives an array of structures and inputs a type of clothing from the user. Prints out a list of all the items that belong to this category; if there is none give an error message, j. newcomers(): receives an array of structures and writes the last 3 items that were added into the array (last 3 elements of the array) to "newcomer.txt". 6 items (1) - Notepad File Edit Format View Help | 19/earrings/20/gold/25.00 25/skirt/60/pink/34.99 13/pants/80/brown/52.50 32/shoes/70/green/40.00 24/ shirt/90/black/32.79 68/tshirt/50/white/9.99 47/shoes/80/teal/35.70

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions