MITS4002
OBJECT-ORIENTED SOFTWARE DEVELOPMENT
Project (25%)
Tattslotto
You will be marked based on your submitted zipped file on Moodle. You are most welcome to check your file with your lab tutor before your submission. No excuse will be accepted due to file corruption, absence from lecture or lab classes where details of lab requirements may be given.
Please make sure that you attend Lecture EVERY WEEK as low attendance may result in academic penalty or failure of this unit.
Programming Project
Part 1: Arrays & Inheritance
Marks: The project is assessment for 25% of final mark for the subject. The project is composed of two parts: Part 1 and Part 2.
Problem Description
This project is based on the design, and implementation in Java, of the seven different Lottery games being Saturday Tattslotto, Oz Lotto and Powerball.
Details of these games can be found at http://www.thelott.com
In Part 1 of the project, you are asked to use arrays and inheritance to code versions of these games and in Part 2 to create an appropriate GUI that writes to a report file.
Note: GAMBLING can be a serious problem for some people. Your lecturer DOES NOT encourage you to gamble.
Summary of Some of the Lottery Games
(From the Help pages of the above web site)
Game |
Day |
Description |
Tattslotto |
Saturday |
45 balls numbered 1 to 45, from which 8 balls are randomly selected. The first 6 balls are the winning numbers and the last two balls drawn are the supplementary numbers. |
Oz Lotto |
Tuesday |
45 balls numbered 1 to 45, from which 9 balls are randomly selected. The first 7 balls are the winning numbers and the last two balls drawn are the supplementary numbers. |
Powerball |
Thursday |
35 balls numbered 1 to 35 from which 7 are randomly selected. An eighth ball, the Powerball, is then drawn from a separate machine containing 20 balls numbered 1 to 20. |
You will notice from your research and examination of the table that all games have several things in common.
All games
Also, each of the randomly generated numbers have a minimum and maximum possible value, for example: For Powerball, the minimum value is 1 and the maximum value is 35.
An abstract class, LuckyGame can be used to represent the generic concept of a game of chance. A suitable partial design is shown in the following UML diagram. In the UML diagram:
UML Diagram
Code for TestGames
// A class that tests the instances of each class of game //************************************************************* ******* class TestGames { public static void main ( String [ ] args ) { final int NO_OF_GAMES = 7 ; LuckyGame [ ] games = new LuckyGame [NO_OF_GAMES]; TattslottoGame myGame = new TattslottoGame ("Tattslotto", "Saturday", 1 , 45 ) ; TattslottoGame OzLotto = new TattslottoGame ( "OZ Lotto", "Tuesday", 1, 45 ) ; TattslottoGame WedsLotto = new TattslottoGame ( "Tattslotto", "Wednesday", 1, 40 ) ; Tatts2Game tatts2 = new Tatts2Game ("Tatts2", "everyday", 1 , 99 ) ; PowerBallGame powerBall = new PowerBallGame ("PowerBall", "Thursday", 1 , 45 ) ; ……………………………………………………………………………………..// Super 66 instance ……………………………………………………………………………..// Pools instance games[0] = myGame ; games[1] = OzLotto ; games[2] = WedsLotto ; games[3] = tatts2 ; games[4] = powerBall ; ……………………………………………………………………………………..// Super 66 instance ……………………………………………………………………………..// Pools instance for (int i = 0 ; i < NO_OF_GAMES ; i++) { System.out.print ("\n\n*******************************************\n" ); System.out.print ("Input your numbers for " + games[i].getDay( ) + " " + games[i].getName( ) + " :- " ) ; String input = Keyboard.readString( ) ; games[i].collectUserInput( input ); System.out.println ( games[i] ) ; }// end for }//end main
Sample output
An example of some output from a run of TestGames. NOTE: ALL OUTPUTS ARE ONLY SUGGESTIONS and should be used as a guide to your implementations.
Input your numbers for Saturday Tattslotto :- 1 2 3 3 4 78 1 5 6 Invalid input Saturday Tattslotto numbers are: 31 29 1 6 10 41 supplementary numbers: 25 38 6 user picks between 1 and 45 are 1 2 3 4 5 6 No. of winners 2 + 0 supps match ******************************************* Input your numbers for Tuesday OZ Lotto :- 1 2 3 4 5 6 7 Tuesday OZ Lotto numbers are: 2 29 19 21 36 31 40 supplementary numbers: 5 35 7 user picks between 1 and 45 are 1 2 3 4 5 6 7 No. of winners 1 + 1 supps match ******************************************* Input your numbers for Thursday PowerBall :- 1 2 2 3 4 5 5 Invalid input The user chosen powerball is 5 Thursday PowerBall numbers are: 1 32 34 5 35 33 and the POWERBALL is:- 5 7 user picks between 1 and 35 are 1 2 3 4 5 6 7 and the user chosen POWERBALL is:- 5 No. of winners 2 and you have the POWERBALL etc…..
Programming Project
Part 2: Graphical User Interfaces/Applets & Files & Exceptions
In Part 1 of the project, you are asked to use arrays and inheritance to code versions of 7 Lottery games. In Part 2, using swing classes wherever possible, you need to create an applet for players. The applet should allow a player to choose and run a game of their choice and find out the results of their game. Each time a game is played, the applet writes information about the game to a file called report.txt. This information would be similar to that shown as sample output for Part 1.
For example,
report.txt
Saturday Tattslotto numbers are: 31 29 1 6 10 41 supplementary numbers: 25 38 6 user picks between 1 and 45 are 1 2 3 4 5 6 No. of winners 2 + 0 supps match
If there are any problems creating this file, then the applet reports the problem to the user.
NOTE: It is not expected that you should need to rewrite any of the classes from Part 1 of the
Project. Rather you will create instances of the relevant classes when you need them for Part 2. The application for this project should create at least one new class LuckyGameApplet, however a good design should divide the computational workload and create/use classes where needed. You may even decide to use Threads and create animation!
Applet Appearance
The design of the applet’s appearance is totally up to you; the more colourful and well organized, the better (use layout managers). Choose components that reduce user error, e.g., use check boxes or radio buttons when asking the user to choose the game they wish to play.
As the designer, the functionality of the applet is also up to you, as long as the basic problem description is covered. Feel free to add any extra features that you feel are useful. For instance, you may want to add a quick pick selection for the player, or continually add data to the file over a number of games, run statistics of the games played, etc., etc.
It is necessary to draw a component hierarchy for your final Applet design.
Submission Details
Attach the following page to the front of your submission and submit all materials to your lecturer.
What You Have to Submit
Each student submits
Project Grading
Programs are graded on a 100 marks scale. The marks will be assigned as follows:
MITS4002 – Project Student full name:
Student ID:
Markers Guideline
Program meets specification and is OOP in design |
60 marks |
Inheritance hierarchy |
5 marks |
Component hierarchy of the LuckyGameApplet class |
|
Error checking. Evidence of trial runs & output |
20 marks |
Over presentation |
10 marks |
Total |
100 marks |
Follow Us