daily pastebin goal
55%
SHARE
TWEET

Untitled

a guest Jan 14th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Class representing a city record
  3.  * @author pielily
  4.  */
  5. public class CityRecord {
  6.  
  7.     private String cityName;        // name of the city
  8.     private int x;                  // x coordinate
  9.     private int y;                  // y coordinate
  10.  
  11.     /**
  12.      * Creates a new record with the given parameters.
  13.      * @param name      city's name
  14.      * @param xLoc      city's x coord
  15.      * @param yLoc      city's y coord
  16.      */
  17.     public CityRecord(String name, int xLoc, int yLoc) {
  18.         cityName = name;
  19.         x = xLoc;
  20.         y = yLoc;
  21.     }
  22.  
  23.     /**
  24.      * Returns the city's name.
  25.      * @return  the city's x coordinate
  26.      */
  27.     public String getName() {
  28.         return cityName;
  29.     }
  30.  
  31.     /**
  32.      * Returns the city's x coordinate.
  33.      * @return  the city's x coordinate
  34.      */
  35.     public int returnX() {
  36.         return x;
  37.     }
  38.  
  39.     /**
  40.      * Returns the city's y coordinate.
  41.      * @return  the city's y coordinate
  42.      */
  43.     public int returnY() {
  44.         return y;
  45.     }
  46.  
  47.     /**
  48.      * Returns a string representation of the record.
  49.      * @return  a string representation of the record
  50.      */
  51.     public String toString() {
  52.         return (cityName + ": (" + x + ", " + y + ")");
  53.     }
  54.  
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top