OBJECT ORIENTED PROGRAMMING JAVA
This is a java programming assignment.
This assignment can be done either individually or as a team of at most two
students. The submission date is as specified in the Course Profile and the
submission method will be communicated during semester.
The idea of the Game Cross Numbers is to arrive at the figures given in the
bottom row and the right-most column of the table by following the arithmetic
operators in the order they are given (that is left to right and top to bottom). Use
only numbers in the range specified below the table to complete the blank
+ x 15
+ x +
– x 21
x + +
x + 20
33 10 20
Use numbers in the range 1 – 9
Part 1. (25 marks)
Implement the game with a text based interface and the arithmetic operators +
(add), – (subtract) and x (multiply). Your implementation must include:
1. User must logon with a username and password to play.
2. User can restart a game that they were playing previously.
3. User can generate a new game of dimension n by n (in the example above
n = 6) and also specify the number range allowed. The arithmetic
operators must vary from game to game.
4. As an option, entry of a number that would make the solution so far
entered invalid is flagged immediately.
5. User can ask for help by having a valid next number automatically
inserted into the table.
6. User will get a score that will depend on the time taken, the difficulty of
the game, whether they had selected the immediate notification of an
invalid number and the number of times help was received.
7. User scores can be displayed along with the dimension of the associated
game, time taken and the difficulty of the game.
Part 2. (25 marks)
Inheriting from the classes you generated for Part 1, generate a version of the
game specifically for computer programmers by adding the following features:
1. Add the arithmetic operators / (integer divide) and % (modulus).
2. Add the binary operators & (bitwise and), | (bitwise or), ! (bitwise not)
and ^ (bitwise exclusive or).
3. Add the feature that the result generated from each operator can only be
in the range 0..N (e.g. when a calculation is done, at each step % N is
performed on the answer before the next step is performed).
4. Add an option for the operators to be performed in accordance with the
5. Add the feature that different number systems can be used (e.g. binary,
Part 3. (20 marks)
Design and implement a GUI interface to your game so that the use of the
keyboard is minimised.
1. You must actually write all Java code submitted using either JPLIDE or
2. You must produce a Word documents describing your code and the
testing you have performed. A tool for generating UML diagrams can be
found at http://horstmann.com/violet/ (10 marks)
This assignment is worth 20% of your final grade. The assignment will be
marked out of 100 and marks will be allocated as follows:
1. Documentation of software and testing : 15 marks
2. Quality of Java code (e.g. indentation, appropriate naming conventions,
class structure, method structure,…) : 15 marks
3. Implementation of Game including testing : 70 marks
Please note that all submitted assignments will be analysed by a plagiarism
detector that is specifically designed for assignment submissions containing Java
OBJECT ORIENTED PROGRAMMING JAVA