Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

 Please remember to read and follow all of the assignment guidelines.

This assignment will expand upon the simulation algorithm given in class to produce a program which may be used to predict the behaviour of a slightly more complex system. Instead of assuming there is only a single cashier available to handle our lineup for movie tickets, we will allow an arbitrary number of cashiers instead. This would allow - for example- a movie theatre owner to determine the optimal number of cashiers to have on staff to ensure a reasonable wait for tickets.

One way to allow our algorithm to solve the slightly more complicated problem is to keep track of an extra piece of information. In the method, we used in class, we stated that the entry at the front of the lineup queue represented the customer currently at the cashier. If we have more than one cashier, we cannot use this method, since we can only examine the first element in a queue. Instead, the lineup will only contain a queue of waiting customers, not those at cashiers; as soon as a customer gets a cashier, they are removed from the queue. The event queue will have to be modified - instead of holding only 0 or 1 departure events, it will have to hold at most as many departure events as there are cashiers. When one of those departures occurs, then another cashier is free; thus, the event queue will have to keep track of how many departure events are in it.

Since you will have to make the appropriate modifications to the algorithm, you may want to test your algorithm on paper before implementing it. If you can come up with a different way to modify the algorithm, feel free to use it!

Your complete program should open a data file containing a sequence of time and duration values sorted by increasing time, one pair on each line. In a loop, read in values for the number of cashiers; check your input (the number of cashiers has to be greater than or equal to 1). Ask the user of the program whether or not they want to observe your algorithm working. Apply your simulation algorithm to the data in the file with that number of cashiers. If the user wanted to see algorithm work, show the contents of your data structures at each time value (this should include the time, the list of events waiting to happen, the lineup, and the total wait so far). This data should be neatly printed in a table. After your algorithm is done, print out the total amount of time customers spent waiting in line, and the average wait (divide the total wait by the number of customers). Repeat, using the same data file, reading in a new number of cashiers.

Although data structures you choose will largely be determined by the algorithm, you may choose any method of implementation, with one restriction. If you use a fixed-size implementation (i. E, an array), you may not choose the size of the array based on solely on the amount of given input data. If you use an array for your queue, it may have a maximum of 10 entries in it (to simulate the fact that you should not know the size of the input data). If you use an array for the ordered list, it should have the ability to dynamically re-size itself based on the number of entries that will be in it.

Hand in your source code and the output of running your program on the following two data sets: a5test1.txt and a5test2.txt. For each, run the simulation with 1 cashier (your output should show the algorithm work in these cases), 2 cashiers (do not show the algorithm working), 4 cashiers and 5 cashiers (optional).

 

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9523238

Have any Question?


Related Questions in Programming Language

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As