Fill out a readme.txt file with your information (goes in your user folder, an example is provided)
Have a style (indentation, good variable names, etc.)
Comment your code well in JavaDoc style (no need to overdo it, just do it well)
Have code that compiles with the command: javac *.java in your user directory
Have code that runs with the command: java Simulate [numPlates > 0]
You may:
Add additional methods and variables where indicated (each class has its own restrictions). If it doesn't say you may add something, then you may not add them.
You may NOT:
Add any additional methods or instance variables where
Make your program part of a package.
Add additional public methods or variables.
Use any built in Java Collections Framework classes anywhere in your program (e.g. no ArrayList , LinkedList , HashSet , etc.).
Use any arrays anywhere in your program.
Alter any method signatures defined in this document of the template code. Note: "throws" is part of the method signature in Java, don't add/remove these.
Alter provided classes/methods that are complete ( Stack , Queue , Simulate , etc.).
Add any additional import statements (or use the "fully qualified name" to get around import statements).
Add any additional libraries/packages which require downloading from the internet.
Setup
Download the project2.zip and unzip it. This will create a folder section-yourGMUUserName-p2
Rename the folder replacing section with the 001 , 003 , 004 etc. based on the lecture section you are in
Overview: What Goes Up Must Come Down (Spinning Plates)
You are going to build a small game using linked lists. You will have a plate spinner (Syeda) who is using three data structures to spin plates (her hands, a bin, and the air). Her hands will be modeled with a simple data structure that holds a single plate at a time. The bin will be modeled as a stack data structure which can hold any number of items. The air will be modeled as a queue data structure which can hold a specific number of items. An outline has been provided for these classes in the zip file with this document.
There are five plates in the picture above: 2 in the air, 1 in the bin, and 1 in each of Syeda's hands. The bin is a stack, new plates are placed on top and plates are taken off the top. The air is a queue, the front of the queue in this picture is plate (b) and the back is plate (c). Plates are thrown into the back of the queue and taken out of the front of the queue. This produces what is known as the "shower trick" in juggling.
This project is a little different from Project 1: you will not be writing the "driver" program for this, but instead focusing on your data structure implementations. If you complete all the required classes, then the menu, game interactions, and the ASCII part should just work. If it doesn't, theres something wrong with one of your implementations!
Requirements
An overview of the requirements are listed below, please see the grading rubric for more details.
Implementing the classes - You will need to implement required classes and provided template files.
Big-O - The template files provided to you contains instructions on the REQUIRED Big-O runtime for many methods. Your implementation of those methods should NOT have a higher Big-O.
Style - You must follow the coding and conventions specified by the style checker.
JavaDocs - You are required to write JavaDoc comments for all the required classes and methods.
Input Format(s)
No file I/O is required for this project.
Implementation/Classes
This project will be built using a number of classes representing the component pieces of the project. Here we provide a description of these classes. Template files are provided for each class in the project folder and these contain further comments and additional details.
Completed Classes and Interfaces
The Plate Class (see Plate.java) This class is complete. It creates plates with letters.
The Stack Interface (see Stack.java) This interface is done for you and outlines the required methods for the Bin class.
The Queue Interface (see Queue.java) This interface is done for you and outlines the required methods for the Air class.
The Simulate Class (see Simulate.java) This class is done for you and you can use it to simulate Syeda's movements. Enjoy the beautiful ASCII art!
Required Classes
The AttachedList< T> Class (see AttachedList.java) This class, as outlined, is a linked list. It implements Java's List interface as outlined in the class, youll also be adding a few new methods: slice() , reverseCopy() , pack() , and flatten() .
Note: Not all the methods in this class are needed by the simulation of Syeda, but they are all graded. The simulation is to give you some practice using these classes (and something fun to look at), but the project itself is about linked lists, stacks, and queues.
The Bin Class (see Bin.java) This class implements the interface Stack< Plate> . It keeps an AttachedList to use as its internal storage.
The Air Class (see Air.java) This class implements the interface Queue< Plate> . It keeps an AttachedList to use as its internal storage.
The Hand Class (see Spinner.java) This class can store a single item (a plate). It's the simplest one.
The Spinner Class (see Spinner.java) This class does the handoffs (no pun intended) between the bin, the air, and Syed's hands.
Testing
Empty main methods for testing are given to you, so no test code is provided.
You can run the simulation of Syeda once everything is done.
Note: Testing via the simulation only is not a good idea. Many of the methods you need to write are not used by the simulation, but are still a graded part of the project.
Make sure you're running the style checker and javadoc style checker.
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.