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 QueueArray class and fill in the missing methods for the queue data structure.


On Wednesday, October 25th, we will be implementing a Queue with an array with much simpler code than Mondays. It might be helpful to wait to start this lab until after Wednesday's lecture. There is also some hints near in the last several slides of Monday's (10/23) lecture

Since you are writing a queue that represents a Car wash, Your queue will hold Car objects, and must use an array to hold data. 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 define a getInfo() method that returns information about the customer/car.

Next, you will define the QueueArray class, which will be your queue data structure that uses an Array. The queue has a finite size, and that size is specified as an argument to the QueueArray 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 QueueArray 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 MUST use an Array. You cannot use a LinkedList, or an ArrayList

You CANNOT import java.util.Queue;

Hints

We implemented a queue using an Array on the lectures for October 23rd, and October 25th (the more efficient version). You should be able to use some of the code we wrote for those lectures.

Grading (10 points)

Deductions