title: Supermarket Simulator using Queue
body: <p><img src="https://i.stack.imgur.com/ZDAL4.png" alt="enter image description here" /></p>
  <p>I posted this problem earlier and i asked for help on how to approach it. I ended up creating a customer class that generates a random first and last name and also assigns random number of grocery items to a customer every time a new customer object is created.</p>
  <p><strong>Here is the code</strong></p>
  <pre><code>import java.util.Random;
  
  public class Customer {
  
      private String lastName;
      private String firstName;
      private int groceryItems;
  
      private String[] last = { &quot;Jordan&quot;, &quot;James&quot;, &quot;Bryant&quot;, &quot;Bird&quot;, &quot;Wade&quot;,
              &quot;Bosh&quot;, &quot;Griffin&quot;, &quot;Durant&quot;, &quot;WestBrook&quot;, &quot;Anthony&quot; };
      private String[] first = { &quot;Michael&quot;, &quot;Lebron&quot;, &quot;Kobe&quot;, &quot;Larry&quot;, &quot;Dwayne&quot;,
              &quot;Chris&quot;, &quot;Blake&quot;, &quot;Kevin&quot;, &quot;Russell&quot;, &quot;Carmelo&quot; };
  
      public Customer() {
          Random pickLast = new Random();
          lastName = last[pickLast.nextInt(10)];
  
          Random pickFirst = new Random();
          firstName = first[pickFirst.nextInt(10)];
  
          Random pickItems = new Random();
          groceryItems = pickItems.nextInt(25);
  
      }
  
      public String getlast() {
          return lastName;
      }
  
      public String getFirst() {
          return firstName;
      }
  
      public int getItems() {
          return groceryItems;
      }
  
      public void display() {
          System.out.println(&quot;First Name: &quot; + firstName + &quot; Last Name: &quot;
                  + lastName + &quot; Items Purchased: &quot; + groceryItems);
      }
  
  }
  </code></pre>
  <p><strong>CODE FOR QUEUE</strong></p>
  <pre><code>public class Queue {
  
      private int maxSize;
      private int[] queArray;
      private int front;
      private int rear;
      private int nItems;
  
      public Queue(int s) {
          maxSize = s;
          queArray = new int[maxSize];
          front = 0;
          rear = -1;
          nItems = 0;
      }
  
      public void insert(int j) {
          if (rear == maxSize - 1)
              rear = -1;
  
          queArray[++rear] = j;
          nItems++;
  
      }
  
      public int remove() {
          int removed = queArray[front++];
          if (front == maxSize)
              front = 0;
  
          nItems--;
  
          return removed;
      }
  
      public int peek() {
          return queArray[front];
      }
  
      public boolean isEmpty() {
          return (nItems == 0);
      }
  
      public boolean isFull() {
          return (nItems == maxSize);
      }
  
      public int size() {
          return nItems;
      }
  
      public void display() {
          System.out.println(&quot;First Inserted Item to Last Inserted Item&quot;);
  
          if (rear &lt; front &amp;&amp; (!isEmpty())) {
              for (int i = front; i &lt; maxSize; i++) {
                  System.out.println(queArray[i]);
              }
  
              for (int i = 0; i &lt;= rear; i++) {
                  System.out.println(queArray[i]);
              }
  
          }
  
          else if (front &gt;= rear &amp;&amp; (!isEmpty())) {
              for (int i = front; i &lt;= rear; i++) {
                  System.out.println(queArray[i]);
              }
          }
  
          else {
              System.out.println(&quot;Queue is Empty!&quot;);
          }
  
      }
  
  }
  </code></pre>
  <p>Now i was wondering what do i create next? I am just looking for guidance or step by step approach as it will help me learn. Not looking for code. I was thinking that now that i have a customer class i would need to create a Queue that would hold each customer. I know how to write code for a simple int or char queue but i was unclear what the requirements of this particular queue would be , since its holding each customer objects.</p>
  <p>Please correct me if i am wrong anywhere in my customer class code and also i would appreciate if someone can provide me steps for the next stage and what i should do .</p>
  <p>I am sorry if question is poorly worded as my English is not good and i am certain if i can make this small program working on my own i will have much better understanding of java and Object Oriented programing.</p>