University of Central Florida
COP 3223 Introduction to Programming in C
5
Assignment 7
Due Wednesday, December 2, 2020 up to 100
Thursday, December 3, 2020 up to 90
Friday, December 4, 2020 up to 80
Saturday, December 5, 2020 up to 70
DeliverablesÂ
To complete this assignment you must submit to Webcourses:
1. source code .c file
IntroductionÂ
This assignment provides practical experience parsing data files, working with a linked list and writing a data file.
References
1. Source code examples on Webcourses
a. linkedListWithPrototypes.c
. fileIO.c
c. memoryManagement.c
d. pointers.c
Tasks and Ru
ic
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 e
ors
Run
Source runs with no e
ors
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
Figure 1 Application Start
Figure 2 After Option 2
Figure 3 Assignment7Output.txt After Option 3
Zucchini, Squash, pound, 2.19, 45
Yellow, Squash, pound, 1.79, 15
Tomatoes, Ugly Ripe, each, .99, 67
Strawbe
ies, , package, 4.99, 38
Spaghetti, Squash, each, 1.99, 18
Raspbe
ies, Red, package, 3.99, 50
Radishes, Red, package, .99, 25
Peppers, Jalapeno, pound, .99, 7
Peppers, Green, each, .59, 100
Orange, Navel, pound, 1.99, 80
Okra, , package, 6.99, 12
Mushrooms, Shiitake, package, 4.99, 20
Mango, , each, 3.59, 44
Lime, Persian, each, .10, 60
Lettuce, Iceberg, each, 1.19, 100
Lemon, , each, .29, 40
Kiwi, , each, .99, 20
Green Beans, Stringless, pound, 1.59, 80
Grapes, Red Seedless, pound, 1.99, 8
Eggplant, Japanese, each, 1.59, 10
Cauliflower, , each, 2.59, 26
Cantaloupe, , each, 1.49, 53
Broccoli, Florets, package, 3.45, 67
Bluebe
ies, , package, 3.99, 43
Asparagus, , pound, 2.54, 23
Apple, Granny Smith, pound, 2.99, 100