The initial value of an int is 0. If it is not assigned a different value, its value will stay at 0.
Read the API doc for the currentTimeMillis() method to see what value it returns.
Use an...
Type: Posts; User: Norm
The initial value of an int is 0. If it is not assigned a different value, its value will stay at 0.
Read the API doc for the currentTimeMillis() method to see what value it returns.
Use an...
Don't call the System.currentTimeMillis() method in the constructor for the exit time. The exit time should be set when the customer object exits the wait queue by setting exit_time to...
If the variable is public use an assignment statement to assign it the value returned by: System.currentTimeMillis();.
What class is the getTime() method in and what does it return?
What is the problem calling a method from inside a loop?
The System class has a method that returns the PCs time.
What happened to the Customer class's toString() method? See post#50.
When the customer is added to the wait queue, set the customer's arrival time to the current time.
When the customer is removed from the wait queue, compute the waiting time by subtracting the...
Do you know what that is?
That doesn't make any sense. How was it coded? Working with Station objects when Customer objects have the data???
Customers wait in the queue. Customers are...
I think its time to go back to the design and describe what you are trying to simulate.
My design was for a company like a bank that had a number of tellers(I). Customers(II) arrive at a variable...
Why is the cashiers an array of Station?
Why is there a 10 in the for loop? That should be a variable defined at the top of the class.
The array shouldn't be null. The slots in the array...
There is a method that removes an element from the list.
Use an assignment statement to assign a value to a slot in an array.
Impossible and unrealistic.
??? The scaling of time means 3ms is used for 3sec
What can happen in 3 seconds? That is not a reasonable time to do anything.
There is no wait time if the customer goes directly to a cashier...
The cashiers process Customers not Stations.
Do you know how to use an array? Take a look at the tutorial: Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
What is...
If the model is going to use clock time, the time the customer is added (and removed) could come from the System class's currentTimeMillis() method.
Next try defining the cashiers array.
Add code...
The toString() method's DEFINITION is added to the Customer class. You don't call the method.
The println() of the line object will call the toString() method and change this: [Customer@8955b34]...
Now you need to add code to save the time the Customer object is added to the queue.
And add a toString() method to the Customer class that returns the id number for the customer and the time the...
I thought it was supposed to be a minimum of 10.
Where is the class to hold the Customer's data? Things like time of arrival in queue and what cashier is doing the processsing and how much time...
What code would you put in a Customer? I don't have any code in mine.
No. The cashier slots are empty at the start of the simulation and then become available when the processing for a Customer...
You can create an array of any datatype: primitives like int or objects like String or Customer.
Customer[] cashiers; // define array for cashiers
No. See post#22. The Customers are generated ...
The queue would be in the main class. It would hold Customer class objects.
What is the third class?
The cashiers could be an array of Customer objects. The Customer in a slot would be the...
Using the clock model: There would be one main class and a class for the customers, a class to handle the timer events. The main class would start a thread that would have a loop to generate x...
Can you get more information from your tutor about this assignment? Both solutions I've been talking about involve classes and techniques that you have not studied yet.
I'd scale it down farther....
That's a completely separate problem. Don't mix it in with the rest of the code for now. Come back to it later.
What is the array: list for? The customers should NOT be named. Give them...
In the clock time model, the timers would be for the cashier processing.
I can't see that you have the knowledge yet to write a clock time model.
The event time model requires random numbers...
This thread has a good description: http://www.javaprogrammingforums.com/object-oriented-programming/16861-multi-queue-simulation-theory.html
I don't remember seeing any assignments like this one...