Reference no: EM133482110
Question:
In this assignment you need to write C program that simulates total sales for an online fruits/vegetables store. Your role is to help this store manage the payments process and print out the receipts for the customer.
Main Requirements:
A. Write the following data types to access/retrieve "cartList" linked list:
1. Create struct type called Item that contains the following information: item ID, item name, item price , and quantity (i.e. number of units per an item).
2. Create array of string that contains 10 types of fruits and vegetable. For example, char itemsName[15][15] = { "","Carrot", "Apple", "Orange", "Parsnip", "Avocado", "Blueberry", "Cherry", "Asparagus", "Cabbage", "Celery"};
3. Create array of double that contains the prices of the items in Names respectively. double itemsPrice[15] = { 0, 1.5, 2.25, 2.75, 1.25, .99, 1.25, 2.25, 2.00, 3.5, 1.25};
4. Create struct type called Item that contains the following information: item ID, item name, item price , and quantity (i.e. number of units per an item).
5. Create struct called Node that contains the item and a pointer to an item.
6. Create shopping cart as a linked list of items called "cartList".
B. Write the following functions to manage the "cartList":
Randomly create 10 ID items( from 1 to 10} with their quantities { from 1 to 10 } and add them to myCartList. You need to retrieve the name and the price from the Names and price lists.
1. Add an item to the cartList.
2. Update the quantity of a given item ID in cartList.
3. Delete an item ID from the cartList.
4. Display Items- including the number of items in the cart and the total payment.
5. Compute Payment - the number of items in the cart and the total payment
2Spring/Summer 2023- Prog20799 Data Structures and Algorithms Development in C
6. Save the items in a file called "receipt.txt" including items detail, number of items, and total payment.
C. In your C program you should:
• Use proper C libraries.
• Avoid using hardcoded values (use #define when appropriate).
• Use reasonably optimized code: minimize time & space complexity, place data on the
heap, avoid repetitive code, etc.
D. Answer the following questions
• -What are the data types used in this program?
• -Can you explain how the program works, step by step?
• -Can you explain any algorithms (e.g., Sorting/searching) or techniques you used in your program?
• -How are data allocated?
• -What challenges did you face when writing the program and how did you
overcome them?
• -Can you explain how the functions in your program are designed to improve modularity, code organization and reusability.