Course web page: Introduction to Computer Science for non-majors II James Tam | Return to the course web page |
Due Friday Feb 26 at 4 PM
You are to write part of a computer simulation. 'Entities' inhabit a 'World'. You are given the code for the 'Entity.java' class definition which can be found in the assignment directory (in UNIX /home/219/assignments/mini_assignment2). Use this code to implement class 'World' and the 'Driver' class. The latter will be starting execution point of the program containing the main() method. You will receive credit for implementing the following capabilities in the World class:
|
|
|
|
|
|
|
|
Figure 1: The display of array elements bounded in the four directions (starting location of object at [1][1]) |
|
|
|
|
|
Figure 2: Any out-of-bound destinations will result in an error message. Any negative coordinates will end the simulation program. |
|
|
To help you see the operation of the various features there is a sample output file in the assignment directory: [output.txt]
Marks earned | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Grade point | 4.0 | 3.8 | 3.6 | 3.4 | 3.2 | 3 | 2.8 | 2.6 | 2.4 | 2.2 | 2 | 1.8 | 1.6 | 1.4 | 1.2 | 1.0 | 0.8 | 0.6 | 0.4 | 0.2 | 0 |
You will need to use the built in code class Scanner for input. Beyond that (and common sense operators and functions such as those for output and mathematical operators), unless you told otherwise, you will need to write your own code and cannot use other pre-written Java classes or operators.