Wednesday, February 8, 2017

This code will store the coordinate of a square in the 3D board

/**
*[Coordinate]

*NAME:       [Gunarath A. M. Raveen]
*Assignment: []
*QUESTION:   []
*
*PURPOSE:    [To store the coordinates of a particular square in a 3D game board]
*/

public class Coordinate {

  public int level;
  public int row;
  public int column;

//constructor that initialize the level, row and column
  public Coordinate(int newLevel, int newRow, int newCol){
    level = newLevel;
    row = newRow;
    column = newCol;
  }
  
//to convert the list to a string of the form 
  //(2,1,3)
  public String toString(){
    return "("+level+","+row+","+column+")";
  }
}

No comments:

Post a Comment