CS251L - Fall 2012

Intermediate Programming

Section 002

Jan Monterrubio

Email: janmonterrubio@gmail.com

Office: FEC 3rd Floor Lounge or (FEC 309)

Office Hours:

Wednesday 3 - 5 PM

Friday 2 - 4 PM

Full TA and Tutor Schedule

If these times don't work email me and I'll make sure you get the help you need.

Grammers, the Game

September 25th, 2012


Bizarre Entertainment, a company well known for making the strangest board games, has come up with the newest fad for the party industry. Bizarre Entertainment has come up with "Grammers", a game about words and improper grammar. Grammers is a game which is no fun unless the players are in a non-sober state, the rules are quirky and the objective of the game is to assert both lexical and hastening dominance. However, Bizarre Entertainment isn't interested in launching a mass prototype making for the board game, and has decided to have players play test the game in a virtual environment. Thus, once again, they must rely on you to help them out.


You must provide BizarreEntertainment with two classes, GrammerStack and GrammerQueue. However, they would like you to do so in a very specific way, and thus provide you with some assistance files:

  • EmptyException - utilized for when a GrammerStructure is empty.
  • FillException - utilized for when a GrammerStructure is full.
  • GrammerStructure - a basic data structure for the Grammers game.
  • StringStack- an interface defining what can and cannot be done with a StringStack.
  • StringQueue - an interface defining what can and cannot be done with a StringQueue.
  • GrammerTester - a tester / grader for both StringStack and StringQueue.

  • You should look over these for they include some details on what each thing must do or can do.

    GrammerStack A GrammerStack is unlike a regular stack. First of all, it only allows Strings to be stacked onto each other. It only allows a certain amount of Strings at a given point, and will cause a FillException if the GrammerStack is at full capacity and someone attempts to stack an extra String on top of it.

  • GrammerStack MUST HAVE a constructor:
    public GrammerStack(String structureName, int limit)
  • It MUST implement StringStack
  • It MUST extend GrammerStructure
  • It MUST be a public class
  • Your declaration should look something like this:
    public class GrammerStack extends GrammerStructure implements StringStack
  • GrammerStack has a fixed size, determined by limit
  • GrammerQueue Unlike a GrammerStack, a GrammerQueue can be filled until there is no physical space in the universe to place more Strings in any given GrammerQueue. As well as the GrammerStack, the GrammerQueue only allows Strings to be placed within it. It will also cause EmptyExceptions when given situations arise.

  • GrammerQueue MUST HAVE a constructor:
    public GrammerQueue(String structureName)
  • It MUST implement StringQueue
  • It MUST extend GrammerStructure
  • It MUST be a public class
  • Your declaration should look something like this:
    public class GrammerQueue extends GrammerStructure implements StringQueue
  • GrammerQueue does NOT have a fixed size, it should be able to grow in size as required

    You can only use a String[] as your underlying structure. Sometimes, we must reinvent the wheel in order to learn something. This lab was designed to get you to learn about Stacks and Queues, these have already been implemented in Java for you, however you cannot use anything previously implemented. If you have an underlying Stack or Queue or anything from collections, you will receive a 0 for the Requirements(75) portion of your lab. We will search (ie grep "import Collection") ) for these and computers are quite efficient at finding String literals in files. Do not do this, you have been warned.

    Comment Specification

    Look at the provided code, a good example of how to comment things. When implementing an interface, you ONLY have to comment the method once, when declaring it within the interface. Implementing classes of the interface should use the @Override notation for the method, indicating that the method is overriden and the doc for it comes from somewhere else.


  • We are trying to save trees, kindly print only GrammarQueue and GrammarStack.
  • These must be stapled.
  • You will have to submit these 2 files, and these two files only. No ZIP this time, just .java files. Send them to the email cs251f12ATgmailDOTcom . The Subject of your file must be Formated as such NAME-LASTNAME-SECTION DateOfLab. IE, my submission would be Jan-Monterrubio-002 9/25
  • Notes

    Stay posted, we are slowly (slower than a turtle) transitioning into a web-based submission system in which (hopefully) your files will be graded on site out of the requirements and you can see your score in real time. Hopefully, sometime in the future, you'll no longer have to submit files via email.

    Bizarre Entertainment does not hold itself responsible for any damage occurred whilst playing "Grammers" in real life