Introduction

This assignment provides more practical experience parsing data files and creating a linked list and builds upon it with recursion and writing a data file.

Activity

Define a linked list node to include

char produce[20];
char type[20];
char soldBy[20];
float price;
int quantityInStock;
struct produceItem *next;

main()

- Provide the user a menu of the following options:
1. Stock Produce Department
// call function to read in the data file
2. Display Produce Inventory
// call function to display the data in the format shown in figure
3. Reverse Order of Produce Inventory
// call function to recursively reverse the order of the linked list
4. Export Produce Inventory
// call function to write out the ending inventory in the format shown in figure
5. Exit Program
// exit the program

- Use a conditional statement to evaluate the user’s selection
-See Figure 1 for the output display

Function to read the data file as nodes of a linked list

Read in the contents of data file "AssignmentTwoInput.txt" into the node data structure and generate a linked list using stack methodology of pushing each new node on to the linked list

Test Case 1

Perform Test Case 1, results in expected outcome

Function to display the linked list

Traverse the linked list and display the data of each node formatted as shown in Figure 3

Test Case 2

Perform Test Case 2, results in expected outcome

Function to reverse the linked list

Use recursion to reverse the order of the linked list

Test Case 3

Perform Test Case 3, results in expected outcome

Test Case 4

Perform Test Case 4, results in expected outcome

Test Case 5

Perform Test Case 5, results in expected outcome

Test Case 6

Perform Test Case 6, results in expected outcome

Function to write produce inventory to a file

Write out the elements of the linked list to data file “AssignmentTwoOutput.txt” so that it replicates the example provided

Exit the program

Write the appropriate code to exit the program

Test Case 8

Perform Test Case 8, results in expected outcome

Compile

Source compiles with no errors

Run

Source runs with no errors

Comments

Source includes comments
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.