Introduction
This assignment provides practical experience parsing
data files, working with a linked list and writing a data file.
Tasks and Rubric
Activity |
|
Define a linked list produceItem node to include |
char produce[20]; char type[20]; char soldBy[20]; float price; int quantityInStock; struct produceItem *next; |
|
1.
Declare a global
struct variable as the head of the linked list |
main() |
- Provide the user
a menu of the following options: // call
function to read in the data file 1. Stock
Produce Department // call
function to display the data in the format shown in figure 2. Display
Produce Inventory // call
function to the elements to the output file 3. Writing the linked list elements to output
file Assignment7Output.txt // exit the
program 4. Exit Program - Use a
conditional statement to evaluate the user’s selection -See Figure 1
for the output display |
Test Case 1 |
Perform Test
Case 1, results in expected outcome in Figure 1 |
Function to read the data file |
Read in the
contents of data file "Assignment7Input.txt" into the linked list |
Test Case 2 |
Perform Test
Case 1, results in expected outcome in Figure 2 |
Function to display the stack |
Traverse the linked
list and display the data of each node formatted as shown in Figure 2 |
Test Case 3 |
Perform Test
Case 3, results in expected outcome in Figure 3 |
Function to output to file |
Write the elements
of the linked list to the output file |
Test Case 4 |
Perform Test
Case 4, results in expected outcome |
Exit the program |
Write the
appropriate code to exit the program |
Compile |
Source compiles
with no errors |
Run |
Source runs
with no errors |
Comments |
Source includes
comments |
Perform the following
test cases
Test Cases |
||
|
Action |
Expected outcome |
Test case 1 |
Select option 1 |
Data file Assignment7Input.txt
is read in, string tokenized; generated a linked list |
Test case 2 |
Select option 2 |
Display the
elements of the linked list, see Figure 2 |
Test case 3 |
Select option 3 |
Data file Assignment7Output.txt
is written, see Figure 3 |
Test case 4 |
Select option 4 |
Program exits
and quits |
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |