diff options
| author | mo khan <mo@mokhan.ca> | 2019-08-11 17:52:15 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2019-08-11 17:52:15 -0600 |
| commit | 03d8081a7382705a81ed2c80e2bc1e4f807b5dc6 (patch) | |
| tree | 55bf7bb5776f0bfdceaf0fa899acff221c8ce724 /src/Q9/Robot.java | |
| parent | 715c2dd39bf0c0d0195ee7191e53d48839fc2578 (diff) | |
add documentation
Diffstat (limited to 'src/Q9/Robot.java')
| -rw-r--r-- | src/Q9/Robot.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Q9/Robot.java b/src/Q9/Robot.java index 62a972d..787f7cc 100644 --- a/src/Q9/Robot.java +++ b/src/Q9/Robot.java @@ -1,3 +1,11 @@ +/** + * Assignment 2, COMP268 Class: Robot.java + * + * @description A class used to represent the location of a robot on a grid. + * @author: mo khan Student ID: 3431709 + * @date August 5, 2019 + * @version 1.0 + */ package Q9; public class Robot { @@ -27,31 +35,56 @@ public class Robot { private int x; private int y; + /** + * Constructs an instance of a robot. + * @param x the x coordinate of the robot. + * @param y the y coordinate of the robot. + */ public Robot(int x, int y) { this.x = x; this.y = y; } + /** + * @return the x coordinate + */ public int getX() { return x; } + /** + * @return the y coordinate + */ public int getY() { return y; } + /** + * @param x the x coordinate to move to. + */ public void setX(int x) { this.x = x; } + /** + * @param y the y coordinate to move to. + */ public void setY(int y) { this.y = y; } + /** + * @return true if the robot is at the given coordinate + */ public boolean atPosition(int x, int y) { return getX() == x && getY() == y; } + /** + * @param r1 robot one. + * @param r2 robot two. + * @return the grid with each of the robots printed. + */ public static String printGrid(Robot r1, Robot r2) { String grid = ""; |
