COMP 1406 - Assignment 2 Outline
COMP 1406 - Assignment 2 Outline
Note: Repeatedly changing the scale should not ”change” the value of the temperature. For
example,
• The getter method either returns an array of doubles with exactly two doubles in it or returns
null. If the object was created with one more more Temperature objects in the constructor’s
input array then the output consists of the maximum temperature of all Temperature objects
passed to the constructor and a count of how many times that maximum was present in the
array passed to the constructor (in that order). If zero Temperature objects were passed to
the constructor (in the array) then the getter returns null.
Note: The max temperature returned must be displayed in the Kelvin scale.
Note: Different Temperature objects in the array passed to the constructor may have different
temperature scales set for themselves.
Since the Temperature objects will store a floating point number for the temperature, you will
use the provided EPSILON constant in the MaxTemp class and consider two temperatures as equal
if their absolute difference is smaller than EPSILON. Therefore, if Math.abs(temp1 - temp2) <
ESILON then temp1 and temp2 are considered equal.
For example, if the array
is passed to the constructor, and EPSILON = 0.1, then the getMax getter will return [1001.12,
2.0].
The return value should still display the maximum temperature (in K). In the example above,
even though we consider 1001.11 and 1001.12 the ”same”, 1001.12 is still the max to be returned.
Note: Your code must use encapsulation. Your grade will be reduced by 5 marks if you do not use
encapsulation.
• The TicTacToeApp program will run the game, using a Board object and two Player objects.
• The Player class will implement a player in the game. A player could be a human user (and
so user input will be needed) or a computer.
• The Board class will be the board in the game. It can either be a 3x3 grid or a 5x5 grid. The
constructor of the class will create an appropriate grid.
• User input for specifying which grid element in the board will be a comma separated list of
two numbers, where the first number is row (starting at 0) and the second number is the
column (starting at 0). The amount of whitespace around the numbers (and comma) can be
arbitrary.
• A single command line argument (for the TicTacToeApp program) will specify if the game
is a 3x3 or 5x5 grid. Acceptable command line arguments will be "3", "5", "three" and
"five". For any other command line argument (or lack) your program will terminate with a
usage message (of how to run the program properly).
• The game board must be displayed before any player makes a move.
Note: Style for this problem includes class design. Encapsulation is required.
Put your Board.java, TicTacToeApp.java, Player.java and any other .java files you
created in your assignment2.zip file.
Submission Recap
A complete assignment will consist of a single file (assignment2.zip) with at least following five files
included: Temperature.java, MaxTemp.java, TicTacToeApp.java, Board.java and Player.java.