You should write a Java, program which simulates the queuing and service of a set of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You should write a Java, program which simulates the queuing and service of a set of requests at a fast-food restaurant. Input consists of the following data: The number of primary servers in the system. The number of secondary servers in the system. • A set of service requests each consisting of an arrival time and two service times. This set is terminated by a dummy record with arrival time and service times all equal to 0. (Note: the arrival times are sorted in ascending order). For example, the data file: 32 123 335 322 432 524 000 indicates there are 3 primary servers and 2 secondary servers. The first service (customer) arrives in minute 1 (first minute of simulation), and the service requires 2 minutes of primary server's time and 3 minutes of secondary server's time. The second service (customer) arrives in minute 3, and it requires 3 minutes of primary server's time and 5 minutes of secondary server's time, etc. The last entry of the data file 0 0 0 indicate the end of simulation. (Note that it is possible to have two customers arrive in the same time as shown in the above sample data (second and third customers).) Your program should read the name of the data file from standard input and then read the data in the named file into the simulation. For example, the following command will trigger the execution of your program by reading the data file provided: ./QueueSim datafile.dat or java QueueSim datafile.dat The simulation is to be of a system with two sets of servers, primary and secondary, with a single queue associated with each set. Customers arrive in the system and are served first by a primary server and, on completion of this service, by a secondary server. If all servers of a particular type are busy, the customer will enter either the primary or secondary queue as appropriate. The simulation should be run until the last customer has left the system. Output, to standard output, for each version of the queuing process will consist of the following data: • Number of customers served. • Time last service request is completed. • Average total service time.. • Average total time in queue(s). Both overall and separate. • Average length of queue. For each queue and overall. • Maximum Length of queue. For each queue and overall. Total idle time for each server. NOTE: Since the question is to assess your understanding of the concept of Queue, you are NOT allowed to use the library of the language that implement queue. You need to write the codes (implementation) of Queue for this exercise. (See point (iii).) The following is just a sample output for your reference. It is by no mean that your output must be the same because the simulation involves a random function (generator). You can also change the format, as long as the required output (The pointer specified above) are available. run: Number of primary servers: 3 Number of secondary servers: 2 ----- Output ----. Number of customers served: 100 Time last service request completed: 480 minutes. Average total service time: 1888/100-18.88 minutes. Average total time in queue: Primary: 716/100 = 7.16 minutes. Secondary: 1716/100 = 17.16 minutes. Total (both) = 24.32 minutes. Average length of queue: Primary: 2636/480 = 5.49. Secondary: 2527/480 - 5.26. Total (both) 10.76 minutes. Maximum length of queue: Primary: 22 Secondary: 32 Total (both) - 54 ---Server data --- P1 P2 P3 330 315 314 Serve Time (in minutes.) 150 164 166 Idle Time (in minutes.) S1 52 466 463 Serve Time (in minutes.) Idle Time (in minutes.) 11 15 End of simulation BUILD SUCCESSFUL (total time: 0 seconds) You should write a Java, program which simulates the queuing and service of a set of requests at a fast-food restaurant. Input consists of the following data: The number of primary servers in the system. The number of secondary servers in the system. • A set of service requests each consisting of an arrival time and two service times. This set is terminated by a dummy record with arrival time and service times all equal to 0. (Note: the arrival times are sorted in ascending order). For example, the data file: 32 123 335 322 432 524 000 indicates there are 3 primary servers and 2 secondary servers. The first service (customer) arrives in minute 1 (first minute of simulation), and the service requires 2 minutes of primary server's time and 3 minutes of secondary server's time. The second service (customer) arrives in minute 3, and it requires 3 minutes of primary server's time and 5 minutes of secondary server's time, etc. The last entry of the data file 0 0 0 indicate the end of simulation. (Note that it is possible to have two customers arrive in the same time as shown in the above sample data (second and third customers).) Your program should read the name of the data file from standard input and then read the data in the named file into the simulation. For example, the following command will trigger the execution of your program by reading the data file provided: ./QueueSim datafile.dat or java QueueSim datafile.dat The simulation is to be of a system with two sets of servers, primary and secondary, with a single queue associated with each set. Customers arrive in the system and are served first by a primary server and, on completion of this service, by a secondary server. If all servers of a particular type are busy, the customer will enter either the primary or secondary queue as appropriate. The simulation should be run until the last customer has left the system. Output, to standard output, for each version of the queuing process will consist of the following data: • Number of customers served. • Time last service request is completed. • Average total service time.. • Average total time in queue(s). Both overall and separate. • Average length of queue. For each queue and overall. • Maximum Length of queue. For each queue and overall. Total idle time for each server. NOTE: Since the question is to assess your understanding of the concept of Queue, you are NOT allowed to use the library of the language that implement queue. You need to write the codes (implementation) of Queue for this exercise. (See point (iii).) The following is just a sample output for your reference. It is by no mean that your output must be the same because the simulation involves a random function (generator). You can also change the format, as long as the required output (The pointer specified above) are available. run: Number of primary servers: 3 Number of secondary servers: 2 ----- Output ----. Number of customers served: 100 Time last service request completed: 480 minutes. Average total service time: 1888/100-18.88 minutes. Average total time in queue: Primary: 716/100 = 7.16 minutes. Secondary: 1716/100 = 17.16 minutes. Total (both) = 24.32 minutes. Average length of queue: Primary: 2636/480 = 5.49. Secondary: 2527/480 - 5.26. Total (both) 10.76 minutes. Maximum length of queue: Primary: 22 Secondary: 32 Total (both) - 54 ---Server data --- P1 P2 P3 330 315 314 Serve Time (in minutes.) 150 164 166 Idle Time (in minutes.) S1 52 466 463 Serve Time (in minutes.) Idle Time (in minutes.) 11 15 End of simulation BUILD SUCCESSFUL (total time: 0 seconds)
Expert Answer:
Answer rating: 100% (QA)
Creating a complete Java program for this simulation is quite extensive Heres a highlevel outline of the steps you should follow and you can implement ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Presented below are the financial statements of Rajesh Company. RAJESH COMPANY Comparative Balance Sheets December 31 Assets Cash Accounts receivable Inventory Equipment Accumulated...
-
You work for an organization that is concerned about automotive technologies. Your supervisor has asked that you examine and report significant conclusions for the following data set: that is below,...
-
2. New Ventures Construction Company purchased excavation equipment on March 15, 2019. ks On June 19, 2023, New Ventures exchanged this equipment for construction equipment owned by Traditional...
-
Consider the following hypotheses: H 0 : = 140 H 1 : 140 Given that x = 148.1, s = 37.5, n = 20, and = 0.02, answer the following questions: a. What conclusion should be drawn? b. Use PHStat to...
-
Floyd Corporation has the following four items in its ending inventory . Determine the final lower-of-cost-or-market inventory value for each item. Replacement Net Realizable Value (NRV) NRV less...
-
Metal rods are spray painted by a machine and a p-chart is to be used to monitor the proportion of rods that are not painted correctly. These defective rods have either an incomplete coverage or a...
-
This chapter has identified a range of stakeholders that managers should consider when determining sustainability performance and reporting. Determine how managers should engage with each of these...
-
Cope Company declares a $90,000 dividend. Cope's common stock has a $5 par value and 80,000 shares outstanding. Cope's preferred stock is 5%, $12 par, and there are 20,000 shares outstanding. Cope...
-
The story is rich dad poor dad chapter 3 1) What is rule #1? 2) What is an asset? Give 3 examples. 3) What is the difference between an asset and a liability? 4) According to "Rich Dad", when can a...
-
Develop an MRP record, similar to the one in Figure 4-17, for wheat germ for the five weeks of January. Wheat germ must be ordered in bulk-container quantities, so the planned orders must be in...
-
A truss system consisting of four bar elements is shown below. The modulus of elasticity of all the elements in this truss system is E = 29.5 x 106 N/mm^2. The cross- sectional areas are given as A1...
-
What are the-advantages and disadvantages of statistical and non-statistical sampling?
-
What is non-statistical sampling?
-
What is non-sampling risk?
-
What does the extent of audit testing refer to?
-
Why are internal controls important to an organization?
-
Order the major bands of electromagnetic radiation from longestwavelength to shortest wavelength. microwaves infrared radiation gamma rays x-rays visible light radio waves ultraviolet light
-
Evaluate how many lines there are in a true rotational spectrum of CO molecules whose natural vibration frequency is w = 4.09 1014 s1 and moment of inertia I = 1.44 1039 g cm2.
-
Use exponential smoothing with ( = 0.1 and 0.2 to forecast values for the data in Problem 10.4. Which smoothing constant gives better forecasts? How would you monitor the results with a tracking...
-
Figure shows the printout from a program that analyses queues. The title 'M/M/3' is an abbreviation to show that the queue has random arrivals, random service time and three servers. What do the...
-
Amwal Corporation had the following costs (in thousands of pounds) over the past six years. Describe what has beenhappening. Year Sales value 1 2 34 5 6 623 625 626 635 677 810 Costs: Design...
-
In July 2017, Latrice Merritt entered a residential lease with Doran 610 Apartments, LLC. Under the terms of the lease agreement, Merritt was prohibited from installing a private security system in...
-
Hemlock Semiconductor Operations, LLC, and SolarWorld Industries Sachsen GmbH, are both companies involved in the manufacture of components for solar power products. Prior to the lawsuit, the two...
-
On March 13, 2009, Juan Mendez Sr. was admitted to a nursing facility. On that day, a doctor employed by the facility determined the father lacked the capacity to give informed consent or make...
Study smarter with the SolutionInn App