Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A Eclipse - Changing the Color Theme - YouTube moodle.cs.usask.ca Chegg Study Guided Solutions and Study Help | Chegg.com Queue Analysis of the Tim
A Eclipse - Changing the Color Theme - YouTube moodle.cs.usask.ca Chegg Study Guided Solutions and Study Help | Chegg.com Queue Analysis of the Tim Horton's Lineup for Coffee As mentioned in class, there are usually two ways in which customers are lined up for access to a number of service windows. Typically in a bank, there is one queue line for everyone and a number of windows. When a window becomes free, the next person at the head of the queue leaves the queue and proceeds to the window. People coming into the bank simply join the single queue at the tail of the queue. At Tim's in Geology, we have the other approach to providing service. Every service window has its own queue. Typically when a person comes up to the lines, they choose the shortest line to join and then stay in that line. It can frustrate some people to see the longer line actually move faster and sometimes people will line hop (i.e. when the other line is shorter than the queue in front of me). https://moodle.cs.usask.ca/pluginfile.php/44297/mod_resource/cont... So which is the best approach? In this assignment we are going to try and determine that. Here are the parameters for the simulation. For both simulations you are to do the following: Run the simulation for 6 hours A new customer group arrives every 1 minute 58 seconds (i.e. as little as 2 seconds apart and as much as 1 min 50 seconds apart A group will consist of 1 to 6 customers following this distribution: O 1 person - 30% O O 2 people -40% O 3 people -20% O 4 people - 5% O 5 people - 3% 6 people -2% Each person in the group joins the queue single file but we can use the same join time for each member of the group. 1. A method called printArray that takes an array of integer values and a boolean value. The method prints the array elements on the same line with one space between each two elements. If the boolean value is true, the elements must be printed in their original order, if it is false they must be printed in reverse order. The method should print a new line after printing the array elements. (1 point) 2. A method called getStatistics that takes an array of integers and an integer, and returns a double value based on the value of the integer parameter as follows: (2 points) If the value of the integer parameter is 1, it returns the summation of the array elements. If the value of the integer parameter is 2, it returns the average of the array elements. If the value of the integer parameter is 3, it returns the maximum value in the array. If the value of the integer parameter is 4, it returns the minimum value in the array. If the value of the integer parameter is 5, it returns the variance of the array elements whose equation is as follows: (x; x)2 - n-1 x is the average, and n is the number of elements in the array. If the value of the integer parameter is none of the above, the method must print the statement "Invalid Choice - ZERO returned" and returns 0. 3. A method called isAscending Ordered that takes an array of integers and returns true if it's ordered ascendingly and false otherwise. (1 point) 4. A method called shiftAndFill that takes an array of integers and a variable length argument list of integers. The method must shift the array elements to the right and fill the emptied indices with the values in the variable length argument. (1 point) Note that this method must not create a new array, it must modify the array in its place. Moreover, it must make sure the number of values in the variable length argument is less that the array length. If not, the array must not be modified. Similarly, if there are no values passed in the variable length argument, the array must not be modified. For example, if the passed array is 6, 2, 5, 1, 8, and the values 10, 9 are passed in the variable length argument, after invoking the method the array must become: 10, 9, 6, 2, 5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started