#16
  1. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    I wouldn't use real, wall clock time for the simulation. That could take hours. What if you want to simulate 500 customers?
    The time between customers needs to be a range of times, say from 0 sec to how many????
  2. #17
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0
    I understand oki I would give the rang of 0 sec - 45 sec is that oki enough ?
  4. #18
  5. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    Its value is one of the parameters to the program that you'll want to be able to change to see what effect it has on the results.
  6. #19
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0
    SO what would the code look like ?
  8. #20
  9. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    What's the design? What is the program going to do? You need to finish describing what the program will do before writing any code. I don't think what I had in mind will work for your assignment. I just noticed: Consisting of 10 customers . That's hardly enough to get good values.
  10. #21
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0
    So do we need to change the whole design because we are only going to have 10 customers.
  12. #22
  13. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    I don't see that there is a design yet. There are just a list of ideas to think about.

    Customers time in queue will be measured.
    That will depend on the number of cashiers and how much time it takes a cashier to process the customer at its station.
    If there are n cashiers, the first n customers will have no wait time. If there is one cashier then each customer will have to wait a function of his position in line * average processing time.
    Last edited by NormR; March 31st, 2013 at 02:57 PM.
  14. #23
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0
    Yes but the n cashiers, the first n customers will have time of 0.

    I know it should silly to input the cashiers but that what I have try and implement.
  16. #24
  17. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    That's all the ideas I have so far.
  18. #25
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0
    I understand it now but I still have no idea how the coding will look like.
  20. #26
  21. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    There'll be a loop. These are the main events:
    Customers will be added to the waiting queue as per the customer arrival rate.
    Customers will be moved to a cashier as a cashier is available.
    Customers will be removed from the cashier after they have been processed.
  22. #27
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0
    This is so far what I've done. Ive made a string array list of customer names and a loop which picks randomly the customer and then adds it into the new queue.

    However what problem I have is i getting duplicates of the same customers how do I make sure it does pick the same customer again ?

    Also I haven't implemented the intervals, which is 0 sec - 45 sec.

    How would i add the intervals and send off the customers ?

    Code:
    import java.util.LinkedList;
     import java.util.Queue; 
    import java.util.Random;
     import java.util.Scanner; 
    public class Station 
    { 
    public static Queue<String> line = new LinkedList<String> (); public static void main(String[] args) 
    { 
    String[] customers = {"Naqi", "Monty", "Mohin", "Paal", "Yasmin", "Maighjoo", "Ashish", "Kevin", "Ruhail", "Tony", }; 
    
    int customer = customers.length; 
    for (int x = 0; x < customer; x++ )
     { int cus = (int) (Math.random() * customer);
    
    line.add(customers[cus]); 
    }
    
    } 
    }
  24. #28
  25. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    There is no need to randomly pick the customers. There is no need to give them names. As far as processing goes, there is the first customer, the second customer, etc
  26. #29
  27. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0
    How would I start the processing coding then ?
  28. #30
  29. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    Back to the design. What are the things the code must do? What should be done first?

IMN logo majestic logo threadwatch logo seochat tools logo