Suppose there is only one customer service available in SAMBA Bank in Thursday morning, in every 4 minutes a new customer arrives at the end of waiting line, each customer will need 7 minutes for the service.
Write a program to print out the information after the first 60 minutes
The time of arriving for each customer
The time of leaving for each customer
How many customers are in the line?
Who is the current serving customer?
please by Java NetBeans - with easy and explain everything !!!!
Here in the code i'm simulating the bank service for the 60 minutes. and for each minutes I am printing the required details.
Also I have make it as simple as possible and added comment at proper places. However if you feel any problem please feel free to ask.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Explanation
1. We make a class Samba
2. For adding a new customer, we are using Queue here
3. Now we initialized all data fields in constructor
4. for simulation, we make a method start_simulation() , which is looping from 0 to 60. here each iteration can be described as a minute.
5.After each minute, we are printing the require data on console
------------------------------------------------------------------------------------------------------------------------------------------------------------
Code :
import java.util.*;
//create a class SAMBA
class SAMBA
{
private Queue<String> cust_queue;
private int count ;
//default constructor to initilize all data variables
public SAMBA()
{
cust_queue = new LinkedList<String>();
count = 0;
}
//start the simulation
public void start_simulation()
{
for(int i=0; i<60; i++)
{
//add a new customer in queue after each 4 minutes
if( i % 4 == 0)
{
count++;
cust_queue.add("C"+count);
System.out.println("Customer Arrived At: "+ i);
}
//deque a Customer after each 7 minutes
if(i % 7 == 0 && i != 0)
{
cust_queue.remove();
System.out.println("Customer Leaved At: "+ i);
}
//number of customers in line
System.out.println("Number of Customers in line: "+
cust_queue.size());
//prnt the current serving customer
System.out.println("Current Serving Customer: "+cust_queue.peek() +
"\n");
}
}
}
public class Main
{
public static void main(String[] args) {
//create the object of SAMBA class
SAMBA s = new SAMBA();
//call the start_simulation which runs for 60
minutes
s.start_simulation();
}
}
----------------------------------------------------------------------------------------------------------------------------------------------------------
Output :




Suppose there is only one customer service available in SAMBA Bank in Thursday morning, in every...
Suppose there is only one customer service available in SAMBA Bank in Thursday morning, in every 4 minutes a new customer arrives at the end of waiting line, each customer will need 7 minutes for the service Write a program to print out the information after the first 60 minutes The time of arriving for each customer The time of leaving for each customer How many customers are in the line? Who is the current serving customer? In java
Suppose there is only one customer service available in SAMBA Bank in Thursday morning, in every 4 minutes a new customer arrives at the end of waiting line, each customer will need 7 minutes for the service Write a program to print out the information after the first 60 minutes The time of arriving for each customer The time of leaving for each customer How many customers are in the line? Who is the current serving customer? in java
Suppose there is only one customer service available in SAMBA Bank in Thursday morning, in every 4 minutes a new customer arrives at the end of waiting line, each customer will need 7 minutes for the service Write a program to print out the information after the first 60 minutes o The time of arriving for each customer o The time of leaving for each customer o How many customers are in the line? o Who is the current serving...
Trader Joe’s has one register open with the customer service employee able to process one customer every 4.8 minutes. There are approximately 2 customers checking out per hour (i.e., arrival rate during off-peak hour). What is the utilization of the customer service employee ? What is the average number of customers in the waiting line? What is the average customer waiting time in line (in minutes)? What is the probability that there will be more than one customer waiting in...
JAVA CODE REQUIRED
A barber shop has one or more barbers who service customers as they arrive on a first- come-first-serve basis. Depending on the type of haircut a customer desires the service time varies. A barber shop also has a limited number of chairs for waiting customers. If all the chairs are filled, an arriving customer leaves without entering. For this assignment you will simulate a barber shop with customers arriving at various times each requiring a variety of...
4. When John enters the bank office, there are four customers waiting in line and one customer is being served. There is a single clerk and the service time is exponentially distributed with λ-10 customer per hour, independent of everything else. (a) (2 points) What is the average service time per customer? (b) (4 points) What is the distribution of John's waiting time? (c) (4 points) Calculate the expected value and variance of John's waiting time. (d) (10 points) It...
1) A fast-food franchise is considering opening a drive-up window food service operation. Assume that customer arrivals follow a Poisson distribution ( interarrival times follow an exponential distribution), with a mean arrival rate of 24 cars per hour, and that service times follow an exponential probability distribution. Arriving customers place orders at an intercom station at the back of the parking lot and then drive up to the service window to pay for and receive their order. The following four...
In Java, complete the following: During the lunch hour, the ATM machine in a large office complex is in heavy demand. Customers complain that the waiting time is much too long. The local bank considering the addition of a second ATM machine. But first, the bank needs a few statistics to justify the cost of adding a second ATM machine. Using a Queue, simulate a waiting line at the ATM machine for a period of one hour. Make the following...
4. When John enters the bank office, there are four customers waiting in line and one g served. There is a single distributed with A10 customer per hour, independent of everything else. (a) (2 points) What is the average service time per customer? (b) (4 points) What is the distribution of John's waiting time? (c) (4 points) Calculate the expected value and variance of John's waiting time (d) (10 points) It has been 15 minutes and now John is the...
A local Walmart is adopting its new Corporate customer drive-through order pick-up program. Based on its serving region and demographics (households with smart phones, internet access, on-line shopping habits, etc.), it estimates that once launched, customers will arrive randomly according to a Poisson process with a mean hourly arrival rate of 100 cars per hour. This randomness will occur despite the fact that customers schedule a time window for their arrival. During their order pick up, some customers trust that...