Assigned | Wednesday, February 29th |
---|---|
Program Due | Wednesday, March 14nd by 9:00am
Extended to Friday, March 16th by 9:00am |
Weight | 7% |
Updates | A new copy of Symbol.java can be found here. There was a problem with the exception throwing that has now been fixed. |
You can download Project2.java now |
To gain experience in the following areas.
To continue to gain experience in the following areas.
This project is considered an OPEN project. Please review the open project policy before beginning your project.
Once this project is turned in, the code will be reviewed in class as noted on the schedule as “Project 2 Analysis.” If you would like to volunteer your code to be reviewed in class as part of the analysis, please contact your instructor. Your name will be held in strict confidence. This practice has worked extremely well in the past. It is a wonderful way to compare and contrast the different designs that people have used. And think about it -- you get personel (yet anonymous) feedback on your project by your instructor!
UMBC has decided to create a slot machine program to supplement the budget of the Computer Science Department. That way, a number of the underpaid Lecturers can make competitive salaries.
The graphical user interface (GUI) code for the slot machine will be provided
for you as Project2.java
. Here's a
picture of the interface. Your job is to implement the functionality
of the machine. Specifically, you will implement a class named
SlotMachine
to represent the slot machine and a class named
Reel
to represent a reel (the machine has three of them) that
displays six possible symbols (a watermelon, an orange, a plum, a lemon, a
cherry, and the number 7). A class named Symbol
that represents
these symbols as an enumerated type and a file called images
that contains the symbol images will be provided for your use.
You can download and play the demo of the Lucky Seven Slot Machine. This will download an executable jar file that can be executed by double clicking on the p2.jar file.
The Lucky Sevens slot machine has the following eight graphical components.
A game is over after all three reels have been clicked and have stopped spinning. The results of the game will be displayed in the white information area.
Note that there are also three menus (Game, Admin, and Help) at the top of the screen. Their functions are as follows.
To win a game, the symbols on two or all three reels must be the same when the reels are stopped. The payout in credits for each of the symbols is as follows.
So, for example, say you start the game and you have your initial 10 credits. You bet 3 credits, so you now have 7 credits (your bet was deposited in the machine). You spin the reels, and when they stop, they are all oranges. You have won 24 credits (the 3 you bet multiplied by the 8 credits that an orange is worth). The 24 credits are then added to your 7 credits, giving you a total of 31 credits.
Or, you bet 3 credits, which are deposited in the machine, giving you 7 credits. You spin the reels, and when they stop, two of them are plums. You have won 9 credits (the 3 you bet multiplied by half of the 6 credits that a plum is worth). The 9 credits are then added to your 7 credits, giving you a total of 16 credits.
When none of the reels match, you lose. The number of credits that you bet are left in the machine.
Note that you can bet zero credits and still play the game. The information under the Admin menu item simply is not updated.
SlotMachine
, Reel
and
Symbol
classes can be found
here.
Symbol
class and the images
are provided for you Project2.zip. You need to download this file
onto your computer, wherever you like. Now, to create your project and
automatically import Symbols
and images
into
your project, do the following.
File
Import ...
Existing Projects into Workspace
, then click Next
archive
file:
src
, you will see that the
Symbol
class and the images
file are there. You
are now ready to add your SlotMachine
and Reel
classes.Project2
class will be posted in
in about a week. But you can begin coding NOW, as you have
the Javadoc for the two classes that you are responsible for
implementing.SlotMachine
and
Reel
classes must have appropriate method
header comments, including pre- and post-conditions, as shown in
the course coding standards and discussed in class.
SlotMachine
and Reel
classes should have file header comments, including
class invariants.
isWinner
method in the SlotMachine
class. For this project, you do
not need to unit test any other methods.
See the course website for a description of how your project will be graded.
Before submitting your project, be sure to compile and test your code on the
GL system. As you will be using a GUI as the interface for this project, you
must test your code using Eclipse on one of the UMBC lab
machines. You cannot run your code on the GL
system remotely (i.e. using your computer). So,
transfer your code to the GL system, import all of your files (Project2.java,
Symbols.java, SlotMachine.java, and Reel.java) and the images
directory into Eclipse, and test your code.
See the Project Submission page for detailed instructions on how to submit your project.
You may resubmit your files as often as you like, but only the last submittal will be graded and will be used to determine if your project is late. For more information, see the Projects page on the course web site.
Remember — if you make any change to your program, no matter how insignificant it may seem, you should recompile and retest your program before submitting it. Even the smallest typo can cause errors and a reduction in your grade.