Question: For this C++ program can you please complete prog4main.cpp, QItem.h, and QItem.cpp files. Below are the screenshots that can be helpful. So can you please

For this C++ program can you please complete prog4main.cpp, QItem.h, and QItem.cpp files. Below are the screenshots that can be helpful. So can you please complete the files with the C++ code and return to me ASAP. Also you don't need to modify Queue.h file at all. Thanks

For this C++ program can you please complete prog4main.cpp, QItem.h, and QItem.cppfiles. Below are the screenshots that can be helpful. So can youplease complete the files with the C++ code and return to meASAP. Also you don't need to modify Queue.h file at all. Thanks21.11 Program 5: Using queues 1. Introduction This assignment gives you experienceworking with the queue class template we developed in lecture. Your programwill model two lanes- an express lane and normal lane--in a grocery

21.11 Program 5: Using queues 1. Introduction This assignment gives you experience working with the queue class template we developed in lecture. Your program will model two lanes- an express lane and normal lane--in a grocery store, using a Queue object for each. You'll read a file telling you when each customer arrives and how long they'll take, use that information to fill a pair of queues, and then empty each queue to simulate the process of serving customers. Section 2 provides a specification for the assignment, providing details on how your program should handle input and output. The output specification includes a breakdown of what the auto-graded test cases evaluate. Section 3 lists a few useful hints for completing the program. 2. Specification Input specification The only user input to this program is a file name. Your program should open and read the specified file, which always contains 10 input lines representing 10 customers. Each line contains the following information: . A single character representing the lane: 'N' for normal, 'E' for express . An unsigned integer representing the customer's arrival time o File contents are sorted in order of arrival time . An unsigned integer representing the customer's service time (how long it takes to serve a customer once they reach the front of the line)So, for example, the first three lines of the input file filed . txt represent two express lane customers and one normal lane customer arriving at times 2, 7, and 8, with service times 3, 1, and 4: E 2 3 E71 4 Output specification and grading rubric Your program is essentially broken into two parts: reading the file and filling the queues, then emptying the queues to simulate serving customers. The test cases use two separate input files, file1. txt and file2 . txt. I've collected the full program output based on each input file in a pair of files, filed_output. txt and file2_output. txt, which are provided below as downloadable files. Remember, your program doesn't print to a file--it prints to the screen! Reading the file (10 points) To show that your program reads the file correctly, the program must do the following: . Prompt for and read the file name . Print a line indicating you've started reading the file . As each line of the file is read, print a message listing: o The customer number o The lane to which they're going o The customer's arrival and service times . Print a line indicating you're done reading the file For example, here's the output my program generates while reading file1. txt. The file name on the first line is user input; the program prints everything else:Enter input file name: filel.txt Reading filel.txt ... Customer 1 to normal lane (A = l I Customer 2 to express lane {A = 2, S = 3} Customer 3 to express lane {A = 3, 2} Customer 4 to normal lane (A = 5, S = 7} Customer 5 to express lane {A = 6, 1} Customer 6 to express lane {A = E, 2} Customer 7 to normal lane [A = 9, S = 4} Customer 8 to express lane {A = 11, 5 = 3) Customer 9 to normal lane (A = 12, S = 3} Customer 10 to express lane (A = 13, S = 2} Done reading file1.txt Serving customers {40 points} This part of the program is a loop that runs as long as at least one offour conditions is satisfied: - You're serving a customer from the express lane - You're serving a customer from the normal lane 0 "here are customers waiting in the express lane . "here are customers waiting in the normal lane While hose conditions control when the loop ends. your loop also needs a variable representing time, which starts at l and increments ever).f loop iteration. Each time through the loop, your program may take at least one of four actions {although it may do none ofthese}, each of which should be indicated by a line ofoutput: . Start serving a new customer from the express lane . Start serving a new customer from the normal lane . Finish serving a customer from the express lane . Finish serving a customer from the normal lane To start serving a new customer from either lane, three conditions have to be satisfied: . You're not serving anyone from that lane . There's at least one customer waiting in that lane . The current time is greater than or equal to the arrival time of the customer at the front of the queue for that lane Each customer's service time tells you how many cycles you need to spend serving them. Once that time is up, you can treat the current customer as done and you'll be available to serve a new customer. Note that: . You'll need to track how long the current customer has left . A customer with a service time of 1 will start and finish in the same loop iteration . If you finish serving a customer in one iteration, the next customer starts in the following iteration.The output my program generates while serving the customers represented in file1. txt is below: I = 1: Serving customer 1 in normal lane T = 2: Serving customer 2 in express lane T = 4: Done serving customer 2 in express lane T = 5: Serving customer 3 in express lane T = 5: Done serving customer 1 in normal lane T = 6: Serving customer 4 in normal lane T = 6: Done serving customer 3 in express lane T = 7: Serving customer 5 in express lane T = 7: Done serving customer 5 in express lane T = 8: Serving customer 6 in express lane T = 9: Done serving customer 6 in express lane T = 11: Serving customer 8 in express lane T = 12: Done serving customer 4 in normal lane T = 13: Serving customer 7 in normal lane T = 13: Done serving customer 8 in express lane T = 14: Serving customer 10 in express lane T = 15: Done serving customer 10 in express lane T = 16: Done serving customer 7 in normal lane T = 17: Serving customer 9 in normal lane T = 19: Done serving customer 9 in normal lane Done serving all customers3. Hints The template files I've provided contain some hints, particularly the main program. Additional hints are here: Items in queue You can use the array-based queue template we designed in class (or, if you're feeling unnecessarily ambitious, redesign it), which is provided below. You do need some way of representing the data stored in each queue entry, though. I used the QItem class that's also provided with the assignment, which stores each customer's number, arrival time, and service time. I'll let you decide what functions are necessary for your solution; feel free to redefine that class or completely ignore it. File handling hints We talked briefly about file 1/O in Lecture 3, covering ifstream objects for input and noting that you can use an ifstream the same way you use cin. While there's an eof () function for ifstream objects, you don't necessarily need it. A statement using the input extraction operator > > returns false if it fails to read anything, which you can use to your advantage. If myfile. txt contains a list of integers, the code below will read all of those values:int main(} { ifstream inl; ff Input file stream int inval; ff Input value inl.open("myfile.txt"); while {inl }} inval} { /f do something to process input } inl.cloae{); return 0; Customer service hints Did you carefully read the description of the customer service process. particularly the short lists that describe: . "he conditions under which you continue to handle customers? a "he actions this loop might take each time you go through? a "he conditions underwhich you start handling a new customer? . "he conditions under which you nish handling a new customer? If not, you might want to go back and take some detailed notes on that section. Those points come directly from my solution so, while you re absolutely welcome to solve this problem any way you want. do know that the description's based on a working program. Other hints may be added later. if people ask questions that show me I need to provide more into in this specication

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!