-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLocation.java
40 lines (35 loc) · 983 Bytes
/
Location.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/** MineSweeper
* @author Chase Carnaroli
*
* The Location class stores a row and column, which correlates to a position on the grid.
*
* INSTANCE VARIABLES
* int row // Row location on the grid
* int col // Column location on the grid
*
* METHODS
* getRow() -> int // Returns row
* getCol() -> int // Returns column
* toString() -> String // Returns String stating the row and column
*/
import java.util.*;
public class Location {
// Instance Variables
int row, col; // position of the location on the grid
// Constructor
public Location(int row, int col) {
this.row = row;
this.col = col;
}
// returns row
public int getRow(){
return row;
}
// returns col
public int getCol(){
return col;
}
public String toString() {
return "Location: " + row + " " + col;
}
}