C Programming

Learning Goal: I’m working on a c programming question and need an explanation a

Place your order now for a similar assignment and have exceptional work written by our team of experts, At affordable rates

For This or a Similar Paper Click To Order Now

Learning Goal: I’m working on a c programming question and need an explanation and answer to help me learn.
Write a complete C program – you must declare and use a self-referential structure for this question
You are asked to write a c program that deals with the online purchase of TVs. The purchase order is handled first come first served basis. When a customer places an order to buy a TV, the program should search that item in the data base and if it is found the purchase should be processed according to the instructions given below.
TVs available in the shop are kept in a text file called TVs.txt.
At the beginning of the program the details of the TVs are read from TVs.txt and stored in a LinkedList. Then the list of the TVs ordered by customers is saved in a queue. Then the program should take the order from the beginning (head) of the queue and search for it in the LinkedList. If the item found in the list delete it and put this TV in a stack to be able to retrieve for the last TV sold.
The main() function handles all interactions with the user and other functions:
• Calls a function named readTVs()which opens a text file TVs.txt (a sample text file is shown below) for reading and storing names of TVs from the file to a LinkedList in order of name
(insertion should happen in alphabetical order).
• It then repeatedly calls the menu () function to display user options, get the user selection
returned by the menu() function, use a switch (or if ..else if) statement to process user
request by calling appropriate function(s).
Details of options in menu function:
(1) Display the current stock of TVs– here you display the contents of the LinkedList
(2) Add a new TV to stock – you need to insert a new TV to LinkedList
(3) Display next order information – displays the next TV in the order-list (first node of the queue) (4) Display all orders – displays all nodes of the queue
(5) Add order to queue – adds new order to the end of the queue
(6) Process the next order – Processes the first order in the queue. This function searches for this TV in the LinkedList and deletes (if found) from LinkedList and puts it into a stack, deletes from the queue as well.
(7) Cancel last order – It cancels the last processed order. It inserts the TV (top of the stack) back into LinkedList (TV is not added back into queue).
(8) Display info of last order – displays the information of the last processed order (top of the stack).
(9) Update TV file – updates the TVs.txt with the remaining TVs in the list (including the TVs added in option2).
(10) Quit program

For This or a Similar Paper Click To Order Now

Leave a Reply