/Classwork/CS3114 - Data Algorithms/Project 2/CityRecord.java |
---|
0,0 → 1,25 |
// Specific implementation of CityRecord that stores coordinates and a city name |
public class CityRecord implements Record { |
private String name; // City name |
private int x; // X-coordinate |
private int y; // Y-coordinate |
// Constructor initializing a new CityRecord |
public CityRecord(String name, int x, int y) { |
this.x = x; |
this.y = y; |
this.name = name; |
} |
// Encapsulation methods |
public String getName() { |
return name; |
} |
public int getX() { |
return x; |
} |
public int getY() { |
return y; |
} |
} |