Skip to end of metadata
Go to start of metadata

Justin Gelwicks


Project 5: Checkout Lines


The purpose of this project was to apply our newly-found knowledge of node-based linked lists in order to create a representation of checkout lines at an average grocery store. In addition to the classes that created queues, customers, and checkout lines, I also created three line determining classes with unique properties in order to see which method of choosing a line would lead to customers getting out int the most efficient fashion. Running these different implementations in simulation classes, I found that the most efficient process is the one where a customer always chooses the shortest line


PickyCustomer: was one of the line-choosing implementations; it found the shortest line and added a customer to it. I did this by using a for loop to loop through the checkout lines and calling checkouts.get().getNumInQueue(), and set the line to be the shortest if it was less than the previous least. Once the shortest line was found, I added a new customer to the list. As we can see from the data, this method had the shortest check-out and standard deviation times of all of the simulations.

Graph with 10 Items      Graph with 5 Items  check-out and standard deviation times(5)

RandomCustomer: was one of the line-determining classes that were tested. As you can probably tell from the name, this class implemented the random utility package. By placing this withing my chooseLine() method, I was able to create a scenario where a customer randomly chooses a line, and from the data, we can see that logically this is the most inefficient process.

Graph with 10 Items     Graph with 5 Items check-out and standard deviation times(5)


The Pick2Customer class was a line choosing method that allowed the customer to choose the shortest line from two that were randomly selected. While it is not an exact comparison because the lines are randomly chosen, this can be seen as a customer knowing that there might be a better line, but chooses from two because they are too lazy to search for the shortest one. I did this by calling the calling the random chooseline() method twice and then comparing the two. This was far more efficient than randomly selecting lines but not as efficient as directly choosing the shortest one.

Graph with 10 Items     Graph with 5 Items   check-out and standard deviation times(5)

I found that by reducing the number of items the customer object held from ten to five, that the lines would not continue to grow in size.


This project was a great introduction to linked lists and how to order them. I loved seeing how the data distribution reflected what I thought each of the different checkout solutions would do when the lines grew. In short, I found this project rewarding because it allowed me to think about maximizing efficiency and how to do that through writing code.


TA: Ethan

Office hours: Layton