From BU Computer Science
Jump to navigation Jump to search

Stacks and Queues assignment


  • For this assignment you are to finish and adapt a program that simulates a factory that makes and sells towels. The towels only differ by color. The creators of the towels are subcontractors and they report in each day with a certain number of towels, all of the same color. The buyers also come in each day wanting to buy towels (color does not matter). The system alternates between processing a creator and a buyer. The towels are placed on a stack and retrieve off the stack. The stack only has a specific amount of room (50). If there is no room for a creator to add his/her towels, he/she does place what there is room for and then goes back to the end of the creator line with the rest of the towels. If there are not enough towels available for a buyer he/she takes what remains and then goes to the end of his/her line to get the other ones. The system ends when all that can be processed has been processed.


  • The program has been written with a linked list implementation for the queues and an array implementation for the stack. You need to switch that and write an array implementation for the queue (which does not move elements when items are added or deleted) and a linked list implementation for the stack. You need to implement their interfaces.
  • Creating the remaining exception classes.
  • You need to add output statements to the Assembly class to show the events as they happen
  • You should develop a number of test files to supplement the one provided to adequately test your program.
  • Don't forget to update all comments and add any appropriate helper methods (even if this code does not use them).

Extra Credit Options :

  • Add code the Assembly to handle the exceptions from the stacks and queues
  • Extreme testing. Testing all possible situations will result in extra credit

Submission details

Create a software development report that includes the following:

  • A problem summary (the big picture)
  • A list of requirements. (Things that this particular implementation of a solution must do)
  • A list of steps your program does
  • A testing report: What exact input you used and what output you got. Test for special cases.
  • How long it took to write the program
  • Who you got help from (if you got help)
  • At least two things you learned while writing the program
  • Changes (if any) you would make if you had more time and/or skill
  • Create a zip folder with your software development report and your java files and submit that to canvas.

Due date can be found on canvas