This discussion is archived
0 Replies Latest reply: Mar 30, 2013 4:31 PM by 1000147 RSS

Waiting Queue Simulation

1000147 Newbie
Currently Being Moderated
Hi everyone Ive got this homework to complete basically I need to make a waiting queue simulation with Java by using the Queue, LinkedList methods. The points are:

There is only 1 queue.
Consisting of 10 customers arriving at random intervals which u can label them.
Customers time in queue will be measured.
The user should input how many cashiers is.(More cashiers means faster process of customers).
I need to output the different stages of the queue and each customer time in the queue.

So far this is what Im able to get by the way im using Eclipse:

Code Bellow:

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Station
{
public static Queue<String> Customer = new LinkedList<String> ();

public static void main(String[] args)
{
Customer.add("A");
Customer.add("B");
Customer.add("C");
Customer.add("D");
Customer.add("F");
Customer.add("G");
Customer.add("H");
Customer.add("I");
Customer.add("J");
Customer.add("K");

Customer.size();
Customer.peek();

System.out.println("Enter the number of Cashiers here: ");
Scanner userinput = new Scanner(System.in);
String cashier = userinput.nextLine(); System.out.println(Customer.size());
}
}

Edited by: 997144 on Mar 30, 2013 4:30 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points