CMSC 131 - Fall 2019 - Project #7
Suggested target for implementing
Movie and Streaming and Website
and then the SpoiledVegetablesDeck class
(other than the two export methods
export2Darray and export2Darraylist
and the shuffle method)
is by the end of office hours on Tuesday, December 3rd.
Exam #3 is on Friday, December 6th.
Suggested next methods: export2Darray and export2Darraylist
Suggested next method: shuffle
Graded: assignment submission due on Submit Server before 8pm on
Monday, December 9th.
Type of project:
Closed
Objective
This project will provide you with the opportunity to practice with
interfaces as well as have some more practice with generic data
structures, ArrayLists, and two-dimensional structures. The project
is meant to be done in two phases;
Phase 1 before the 3rd exam and
Phase 2 probably waits until after the 3rd exam.
Overview
In this project you will implement some elements needed for a theoretical
Android mobile game being developed by the people building the
Spoiled Vegetables
media critiquing site.
In Phase 1 you will build several classes that implement an interface
called Critiqueable,
and create a new one-dimensional generic data structure with certain
rules for adding/removing things; that data structure will be able to
hold any objects that extend the Critiqueable interface and will support
a simple game of Solitaire.
In Phase 2 you will add to the one-dimensional structure's abilities
by supporting the exporting of data from it and also add the ability
to shuffle the deck.
In this project scenario there is no GUI built yet because another team
is working on that based on the design specifications.
When they complete their visual design they will make use of the classes
you have built.
The application architects have provided you with the
JavaDocs
for the classes, some initial acceptance tests (ExampleTests.java),
and have also created a wider array of acceptance tests (the ones on
the submit server).
Phase 1
- First, read through the Universe.java file to see what it provides
and keep it in mind as you work on the project.
- Next, read the documentation for the Critiqueable interface,
which has been provided.
In this project there will be at least three classes that implement
this interface, the ones you implement;
Movie, Streaming, Website.
- Next, read through the
Movie and Streaming and Website
classes and the method descriptions in the documentation and
implement them as described.
- Then you will be ready to implement the
SpoiledVegetablesDeck
class (other than the two
export methods export2Darray and export2Darraylist
and the shuffle method)
based on the method descriptions in the documentation.
This class will support adding deep copies of Critiqueable objects
to the structure. The structure is a double-ended list where
new things are added to the two ends in alternating order.
Additionally, the class supports two methods that the game designers
have requested;
the ability to have the
Critiqueable objects at the two ends of the list be critiqued
against each other in a game of Solitaire (returning the winner)
and
the ability to shuffle the deck in a certain way.
Casting is something we discussed briefly in class and in the notes
but that comes up in an interesting way here in this project.
Please visit
this summary of casting and interfaces
to see why if you take something out of the ArrayList
but need it to interact with a T reference, you might need to use
casting. For example:
T myValue = (T)arr.get(0);
would allow you to (for example) take a Movie object inside the
list and return it, even though while it was in the list Java might
have only known that it was something that implemented the
Critiqueable interface.
Phase 2
- Add the ability for your SpoiledVegetablesDeck class to export the
contents of the structure as
a ragged two-dimensional structure; one way using the Java array
(export2Darray)
and one way using the ArrayList
(export2Darraylist).
- Add the ability to shuffle the deck the way the
game designers requested.
Please note that in the card game there can be references to two
different Critiqueable objects in the deck that have the same datatype
and the same title and other data.
If you end up using the version of remove in the ArrayList
class that looks for an object rather than the one that goes to an index,
this is potentially important to think about.
Notes and hints:
- The freshenUp() and rottenDown() methods might be called apart from
being used within the solitaireCritique() method.
- The sweepDeck() method might also be called apart from within the
solitaireCritique() method.
- For this project you are allowed to (and will need to) add private fields
to some of the classes, but please do so judiciously and provide
a comment justifying why each/any needs to be added.
Restrictions
- You are expected to use good style (as always), including commenting,
proper indentation, proper choice of variables names, etc.
- While you are free to choose what you feel are the best internal representations
for your data, the signatures of the public methods may not be altered.
- Please remember that we will not be using any of the new features that
Java 8 introduced and that in this course you are not allowed to try to
use any new features that you might read about elsewhere when doing your
assignments.
Project Submission
As always, you will submit your project from Eclipse by right-clicking the
project folder and selecting "submit project".
You may and should, of course, submit as you feel each part is working to
get feedback from our tests, and are able to submit as many times as you want
for public tests, and have the tokens which will regenerate 24 hours after
their use for release tests.
Remember, we only grade the submission that scores the
highest on the automated tests
Note that you are strongly encouraged to read the project carefully and test
your code with your own JUnit tests first.
Grading
Your grade will be computed using the Public and Release tests as listed on
the submit server.
Web Accessibility