CPT 307 Week 5 Interactive Assignment

In this post, I used the queue function. In this Java program I used the add (), element(), offer(), peek(), and poll() methods for the queue function. Here I set up a queue that lists different parts of a car. The queue function is used to remove elements from the beginning of the queue and insert elements at the end of the queue. This is the First in First Out method. The poll function job is to take the first element of the queue and remove it. One thing to note is that in this case, if the container is empty, a null will be presented and not an exception. The remove function deletes the head of the queue In writing this program, I needed to be able to add elements to the queue, and I did this by using the add function. This allows me to add specific items to the list I am building Using the peek stack will retain the first element it doesn’t retrieve or remove the element. The Offer method can insert elements into the queue with no issues. Many times, this is used in p...