Question

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?

[ data structure course, solve in java, please (Hint: use the queue concept )]

Homework Answers

Answer #1

Ans:- Java code for the above question using queue

Code:-

import java.util.*;
import java.util.LinkedList;
import java.util.Queue;
public class Customer
{
        public static void main (String[] args) throws java.lang.Exception
        {
            int no_of_users=0,no_of_customer_served=0;
             Queue<Integer> q = new LinkedList<>();
             for(int i=0;i<60;i+=4)
             {
                 no_of_users++;
                 //after every four minute the new customer was added to the Queue
                 q.add(no_of_users); 
                 // It will print the arriving time of every customer
                 System.out.println("The "+no_of_users+" customer was arrived at "+i+"minute");
             }
             System.out.println();
             int k=0;
             for(int i=0;i+7<60;i+=7)
             {
                k=i+7;
                no_of_customer_served++;
                //after every seven minute a customer leave the Queue
                q.remove();
                // It will print the arriving time of every customer
                System.out.println("The "+no_of_customer_served+" customer was leaving at "+k+"minute");
             }
             System.out.println();
             // remaining size of queue will tell the number of customer left in queue
             System.out.println("The number of customer in the line are "+q.size());
             // the customer at the top of the queue will be the current serving customer
             System.out.println();
             System.out.println("The current serving customer is "+q.peek());
            
        }
}

Output:-

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Coffee Talk is a local café on the waterfront. There is counter service only with one...
Coffee Talk is a local café on the waterfront. There is counter service only with one clerk working the counter. On an average Friday (6 hour operation), 6 customers arrive at the counter every 20 minutes; on average, it takes 3 minutes to serve a customer. Find the following measures of performance of the café: a) The average utilization of the counter clerk b) The average number of customers waiting in line c) The average time a customer spends in...
Please answer the entire problem! Problem 15-25 (Algorithmic) Burger Dome sells hamburgers, cheeseburgers, French fries, soft...
Please answer the entire problem! Problem 15-25 (Algorithmic) Burger Dome sells hamburgers, cheeseburgers, French fries, soft drinks, and milk shakes, as well as a limited number of specialty items and dessert selections. Although Burger Dome would like to serve each customer immediately, at times more customers arrive than can be handled by the Burger Dome food service staff. Thus, customers wait in line to place and receive their orders. Suppose that Burger Dome analyzed data on customer arrivals and concluded...
Burger Dome sells hamburgers, cheeseburgers, French fries, soft drinks, and milk shakes, as well as a...
Burger Dome sells hamburgers, cheeseburgers, French fries, soft drinks, and milk shakes, as well as a limited number of specialty items and dessert selections. Although Burger Dome would like to serve each customer immediately, at times more customers arrive than can be handled by the Burger Dome food service staff. Thus, customers wait in line to place and receive their orders. Suppose that Burger Dome analyzed data on customer arrivals and concluded that the arrival rate is 33 customers per...
Problem 15-25 (Algorithmic) Burger Dome sells hamburgers, cheeseburgers, French fries, soft drinks, and milk shakes, as...
Problem 15-25 (Algorithmic) Burger Dome sells hamburgers, cheeseburgers, French fries, soft drinks, and milk shakes, as well as a limited number of specialty items and dessert selections. Although Burger Dome would like to serve each customer immediately, at times more customers arrive than can be handled by the Burger Dome food service staff. Thus, customers wait in line to place and receive their orders. Suppose that Burger Dome analyzed data on customer arrivals and concluded that the arrival rate is...
Burger house sells hamburgers, cheeseburgers, French fries, soft drinks, and milkshakes, as well as a limited...
Burger house sells hamburgers, cheeseburgers, French fries, soft drinks, and milkshakes, as well as a limited number of specialty items and dessert selections. Although Burger house would like to serve each customer immediately, at times more customers arrive than can be handled by the Burger house food service staff. Thus, customers wait in line to place and receive their orders. Suppose that Burger house analyzed data on customer arrivals and concluded that the arrival rate is 45 customers per hour...
Exercise 11.2.5 Customers arrive at Bunkey’s car wash service at a rate of one every 20...
Exercise 11.2.5 Customers arrive at Bunkey’s car wash service at a rate of one every 20 minutes and the average time it takes for a car to proceed through their single wash station is 8 minutes. Answer the following questions under the assumption of Poisson arrivals and exponential service. (a) What is the probability that an arriving customer will have to wait? (b) What is the average number of cars waiting to begin their wash? (c) What is the probability...
The post office uses a multiple channel queue, where customers wait in a single line for...
The post office uses a multiple channel queue, where customers wait in a single line for the first available window. If the average service time is 1.5 minutes and the arrival rate is 72 customers every hour, using the Queuing.xlsx calculator tool, find, when two service windows are open, a. the probability both windows are idle. b. the average number of customers waiting in line. c. the average time a customer is in the post office.
A system serves customers in the queue one by one. Suppose that the service time A_b...
A system serves customers in the queue one by one. Suppose that the service time A_b for customer b has a mean of 2 min(minutes) and variance of 4. suppose that service time for different customers is independently and identically distributed. (1)Let Abar denote the average waiting time of the next 25 customers. Prob(1.8 min < Abar < 2.2 min) = (2)Find the time t making Prob(aBar > t ) = 0.9.
A fast-food franchise is considering operating a drive-up window food-service operation. Assume that customer arrivals follow...
A fast-food franchise is considering operating a drive-up window food-service operation. Assume that customer arrivals follow a Poisson probability distribution, with an arrival rate of 25 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 to the service window to pay for and receive their orders. The following service alternative is being considered: System C: A two-server operation with...
Four cashiers are on duty in a bank where customers may be assumed to arrive independently...
Four cashiers are on duty in a bank where customers may be assumed to arrive independently and at random, at an average rate of 60 per hour. If a cashier is free, then an arriving customer receives immediate attention; otherwise a central queue is formed. The service time for each cashier may be assumed to be exponentially distributed with mean 2 minutes. The traffic intensity  is . Assume that the queue is in equilibrium What is the probability that at any...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT