Search:

Type: Posts; User: spiderd

Page 1 of 2 1 2

Search: Search took 0.29 seconds.

  1. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    The *1 I can change later i just put that there to test everything quickly. So your saying that I should remove the System.currentTimeMillis() ? And yes or are right about no wait_time exist for the...
  2. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    Norm can you check this ive got two System.currentTimeMillis() for the arrival_time and exit_time but how do state that the arrival_time corresponds to the add customer System.currentTimeMillis() ...
  3. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    Norm ive done this to the current loop:


    try
    {
    Thread.sleep(wait * 1);
    line.add(new Station());
    System.out.println(line);
    System.currentTimeMillis();
  4. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    when I get the current time I then store it into the arrival time which is in the customer class where the data is store right and from the i nee to get the exit again store that in the customer...
  5. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    in the loop when the customer is added to the queue how would you implement the .getTime method inside the loop.
  6. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    and then how do I output the customer name as well as the wait time or is it just going to keep saying customer@fjf272638b etc
  7. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    the reason why the whole thing went into station was because you suggested to rename the class and use a sub class called customer to hold all the data. And to be honest it doesnt really matter what...
  8. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    Yes I understand the design theory but its a whole, different story when you try to implement it, using the right methods, syntax etc. And the reason why I made cashiers an array of Station is...
  9. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    The customer removed from the queue goes into the slot right thats what the line.poll does. An ive replaced the 10 with the max_customers
    private int max_customers = 10; //FOR TESTING the cashier !...
  10. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    Oki I didnt put everything in the number generator loop but on a separate loop:



    Station[] cashiers = new Station[cashier];
    for (int i = 0; i < 10; i++)
    if (cashiers != null)
    {...
  11. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    Norm the part where I have remove the customer from the queue and into the cashier station I cant find any syntax which allows you to do that ?

    The queue basicall adds, remove and thats is is a...
  12. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    noo i put the 3 seconds wait there so it simulates that the cashier take 3 seconds to process a customer.
  13. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    the code that I post basically is to remove the current customer from the queue and wait for 3000ms - 3sec untill it removes the next customer. Sorry norm I understand I had to change the current...
  14. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    OKi ive done the generator loop for the empty slot in the cashier array based on what the user input how many cashiers will exist. But the whole thing is being yellow underlined and its asking me to...
  15. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    Oh oki so everytime we now println() of watever object get call the toString() method changes the [Station@8955b34] to the acutal customer name. Ive change the file name as you said to something...
  16. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    Im trying to add the .toString()
    line.add(new Customer().toString()); but underlining the .add so I believe I'm adding it wrong. Also Ive added variables as you described to the very begning of the...
  17. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    I just need to simulate 10 customer apparently and the reason why Im working in seconds is because at the end im going to print out each stage of the so it actually looks like a real queue building...
  18. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    oki this is what ive done so far ive generated maximum of 10 customer object arriving randomly in the queue between 1-4 sec.



    public class Customer implements Runnable
    {
    public static...
  19. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    What do you mean ?
  20. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    So does this mean I can have multiple threads within my Customer class ?
    Also with the customer queue is it best do a while loop to check if the cashier slot is empty if so, then move the customer...
  21. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    oki so there are only two classes one for timer event and the other Customer class. What do you mean the cashier could be Array of Customer objects. I taught a Array is just a list of integers or...
  22. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    oki lets me sum it to my self, there are three classes one for the main class which contains the random customer generator in intervals. The Customer class contains the actual empty priority Queue...
  23. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    ok ive looked up on treads which is basically running multiple classes at once. But what I don't understand is how does threads apply to my assignment of 1 queue, 10 customers getting proccesed....
  24. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    So instead of sleeping for 1 seconds how about 1/4 of second which is 25ms. And what do you mean the Customer class will hold all the data ? Currently ive made a Customer class which retrives the...
  25. Replies
    78
    Views
    2,019

    Re: Queue Simulation

    A random number is generated and then that number is multiple by 1000ms which is within a sleep method hence a simulating random intervals.
Results 1 to 25 of 40
Page 1 of 2 1 2