Skip to content

lucformalmethodscourse/arrayqueue-java-sbt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loyola COMP 271 Project 6: array-based queues

Group activity

In this activity, we'll implement our own array-based data structure, a fixed-size circular queue!

Objectives

An understanding of the following concepts and techniques:

  • ADT implementation perspective
  • queue ADT (see also java.util.Queue)
  • implementing queue as a circular array
  • queues with fixed versus growing capacity
  • algorithms based on the queue's FIFO policy
  • interface-based testing
  • initial exposure to concurrency

Instructions

In this lab, you will have the opportunity to implement a generic queue as a circular array and use this implementation in the context of a typical queue-based application.

Specifically:

  1. Complete the TODO items in the FixedArrayQueue implementation until the tests pass.
  2. Complete the main class SingleQueueService, which reads successive input lines until EOF and puts them on a queue that the background consumer activity processes.
  3. When running the main class, note that the consumer is set to serve customers at a fixed rate. By entering customers' names at different rates, try to create scenarios where customers arrive infrequently enough for the queue to remain empty, or in such quick succession that the queue becomes full.
  4. Answer the following questions:
    • Why does FixedArrayQueue require an explicit constructor?
    • What happens when you offer an item to a full FixedArrayQueue?
    • What happens when you poll an empty FixedArrayQueue?
    • What is the time and (extra) space complexity of each of the FixedArrayQueue methods?

Running the code

To run the tests, please press the green "run" button or, in a Replit Shell window, run

mvn test

To run the main program, in a Replit Shell window, run

mvn exec:java

Grading (total 5 points)

  • 2.5 completion of items marked TODO in FixedArrayQueue and tests passing
  • 1 completion of SingleQueueService and correct behavior
  • 1.5 written part
    • 1.2 responses to the questions above
    • 0.3 grammar, style, formatting

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 90.8%
  • Scala 9.2%