• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to manipulate the value in this simulation code

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys..

I'm a newbie in java and I try to understand the logic of this simulation

I want to control the arrival value of the customer and server.

There is no error but the result is mess up. The code did not match with the logic of simulation.  Can anyone help me?



This is the code that I put inside:





This is the initial code:


 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the expected output and what is the obtained output?
 
Carla Lee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Swastik Dey wrote:What is the expected output and what is the obtained output?






This is the result after I put some of the code.
You can see the Total customers arrived: 472.  
But it suppose to be only 400 right?



I want to calculate the average waiting time for each of the arrival. But i'm stuck. :/

 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That isn't newbies' code. How much programming have you actually been taught?
I am afraid the code is too large for any of us to debug. I think you are going to have to go through the code yourself. Put some print statements in it, so you will know which method is being called when. Also put some counter variables, which will count how many times a particular method is called. That shou‍ld give you a start.

Why are all your methods marked static? Why have you written such long lines? Why do you appear to have documentation comments in the middle of methods? Why are your methods so long? Have you written down the algorithm you are simulating?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic