Lab 8: Queues

Due Date and Submission Requirements


The goal of this lab is:


Directions

You will be writing a Java program that simulates cars using a Car Wash station. Using Lab8Demo.java as a starting point, you will define the CarQueue class and fill in the missing methods for the queue data structure.


Since you are writing a queue that represents a Car wash, each car object will have: You will need to define the Car class, and add any necessary methods. At the very least, you will need to override the toString() method so that it returns information about the customer/car.

Next, you will define the CarQueue class, which will be your queue. You can use either a Linked List or array to represent your queue. The queue has a finite size, and that size is specified as an argument to the CarQueue constructor. Your queue will need to keep track of the front of the queue, the current size of the queue, and the capacity of the queue. You will also need to keep track of the number of cars serviced by the car wash, and how much money the car wash has made.

You are NOT allowed to modify the Lab8Demo class. After creating the CarQueue class, you must define the following methods:

Starting Code

Output

When you run your program, your output should look exactly like this screenshot

Restrictions

You CANNOT import java.util.Queue;

Hints

We implemented a queue in class using an Array and by using a linked list. You should be able to use some of the code we wrote for either of those lectures.

Grading (10 points)