• anonymous
will you please give me codes how to make a grocery line simulator in java?
Computer Science
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • katieb
I got my questions answered at in under 10 minutes. Go to now for free help!
  • KonradZuse
  • rsmith6559
A line is a queue. A FIFO ( first in first out ) data structure. I'd bet that Java has a class for that, and javadoc has info about the class.
  • anonymous
I don't know what is available in Java but if you wanted to build your own instead of using a built in then there would be several options. If you know the maximum size of the queue, you could use an array and modular arithmetic to "move" the head of the line. You could also used a linked list type of structure for any size where you simply "push" (add) elements to the end of the list and "pop" remove elements from the start. These are a couple of options.

Looking for something else?

Not the answer you are looking for? Search for more explanations.