Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c language how to make number ( 4) in main and 5,6,7,9 1. You must create a struct that stores information about a customer

in c language how to make number ( 4) in main and 5,6,7,9

1. You must create a struct that stores information about a customer (name, number of services, line number, time entering line). Note that the storage of the line number is redundant, but is designed to ease implementation. Also, you must need to create a function that can create a customer using dynamic memory allocation, fill out the customer and then return the customer. You have to use this function whenever you need to create a customer. 2. You must create a node struct for a linked list of customers. This struct should have a pointer to a customer struct, and a pointer to a node struct.

3. You must create a struct to store a queue of customers. This struct should have two pointers one to the front of the queue and one to the back. 4. You must implement all of the lines that form as an array of size 15 (stored as a constant) of queues. [It is kind of an array of 15 queues, where each queue is a linked list] 5. You must dynamically allocate memory as appropriate for linked lists. 6. Your queue must support the following operations: a. Enqueue b. Dequeue c. Peek: Return the front of the queue WITHOUT dequeuing. d. Empty (returns 1 if the queue is empty, 0 if it is not) 7. You must free memory appropriately. Namely, when you dequeue, youll free memory for a node, but you will NOT free memory for the customer. You will free this memory a bit later right after you calculate when that customer will finish checking out. 8. You must use the memory leak detector like PA1 and as shown in earlier labs. 9. Due to the nature of the problem, when you process the input, you can add everyone into their appropriate lines right at the beginning, before checking anyone out. This wouldnt work in all simulations (some of which you have to do in time order), but because there is ONLY one check out line, you can get away with it. The only thing you have to be cognizant about is that when you select a line, if the current time is 100 for example, and three lines have customers who arrived before time 100 and the other lines have customers in the front who arrived AFTER time 100, you have to ignore the customers in those lines who arrived after time 100. In the case that all the lines have customers who arrived after time 100, you would take the line which has a customer who arrived first. You are guaranteed no ties for arrival time so this would be unique.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

More Books

Students also viewed these Databases questions