Line - return(Customer)queue.removeFirst Adds a customer to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************* // Author: Lewis/Loftus // // // // A queue class used to represent the customer line at a bank //******************************************************************* import java.util.LinkedList; public class Line { LinkedList queue; //---------------------------------------------------------------- // Creates a new line based on a queue //---------------------------------------------------------------- public Line() { queue = new LinkedList(); } //---------------------------------------------------------------- // Removes a customer from the head of the queue //---------------------------------------------------------------- public Customer nextCustomer()
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { return (Customer)queue.removeFirst(); } //----------------------------------------------------------------// Adds a customer to the tail of the queue //----------------------------------------------------------------public void addCustomer(Customer person) { queue.addLast(person); } //----------------------------------------------------------------// Indicates whether the queue is empty //----------------------------------------------------------------public boolean isEmpty() { return queue.isEmpty(); } //----------------------------------------------------------------// Returns the number of customers in the queue //----------------------------------------------------------------public int size() { return queue.size(); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online