Click here to Skip to main content
15,905,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I am having a problem in simulating a queue that have one server
I need to make a queue of circles that arrive according to an arrival rate
then the circles will move one a time to the server for a service time and disappear I don't know how to do this
Can any one help even by giving hints
I started by making multiple circles using a for loop, but how can I use the timer for each circle to move according to the arrival rate
and how to make the circles stop at the server??

Thanks

What I have tried:

I started by making multiple circles using a for loop
Posted
Updated 9-Apr-18 10:27am

.NET offers a pre-made FIFO queue... Queue Class (System.Collections)[^]
 
Share this answer
 
Comments
Member 7679800 10-Apr-18 1:50am    
If I define a new queue
Queue q = new Queue();
q.Enqueue(??);
Do I need to define a class called circle and pass it as an object
How can I enter circle to the queue ??
Kornfeld Eliyahu Peter 10-Apr-18 2:16am    
Yes. You should have a class that representing your circle and than you can use Queue to store it...
public class Circle {};
Circle oCirc = new Circle();
Queue<circle> oQueue = new Queue<circle>();
oQueue.Enqueue(oCircle);
Member 7679800 10-Apr-18 9:02am    
Thanks I will try it
Member 7679800 10-Apr-18 11:06am    
I have a question about the timer shall I need a timer to move each circle or one timer for all cause when I try to move with timer all the circles move??
Kornfeld Eliyahu Peter 10-Apr-18 11:10am    
Why timer - two separate processes/threads...
One - to receive incoming circles and push them on the queue
Two - to pull out circles one-by-one...
Remember that we don't know what you talk about, we don't see your screen, we can't read your mind.
reread the question, if you understand because you have a knowledge that is not written down on the question, you need to refine the question.
A queue of circle means nothing to us.
 
Share this answer
 
Comments
BillWoodruff 9-Apr-18 20:10pm    
Voted #1: This is not a solution, but a question for the user, and should be a comment.
Patrice T 9-Apr-18 20:46pm    
Hi Bill,
I don't like the 1, but I am happy of the message, At least I can understand the reason of 1.
More like an advice than a question, I would say.
Do you have knowledge about 'queue of circles' ?
Member 7679800 10-Apr-18 1:26am    
the circles is representing a customers waiting for a single server
I didn't write any code yet and finding difficulties
how to make a number of customers (circles) move to a queue then each time enter a server for a service time then dissapear

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900