Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ca.sheridancollege.jollymor.week4.repositories;
- /**
- * NHL Teams from the North Division (2020-2021), or all the Canadian
- * teams during regular seasons (pre 2020-2021).
- *
- * @author Wendi Jollymore
- *
- */
- public enum Teams {
- /** "Calgary", "Flames" */
- CGY ("Calgary", "Flames"),
- /** "Edmonton", "Oilers" */
- EDM ("Edmonton", "Oilers"),
- /** "Montreal", "Canadians" */
- MTL ("Montreal", "Canadians"),
- /** "Ottawa", "Senators" */
- OTT ("Ottawa", "Senators"),
- /** "Toronto", "Maple Leafs" */
- TOR ("Toronto", "Maple Leafs"),
- /** "Vancouver", "Canucks" */
- VAN ("Vancouver", "Canucks"),
- /** "Winnipeg", "Jets" */
- WPG ("Winnipeg", "Jets");
- private String city; // city team belongs to
- private String teamName; // name of the team
- //private HashMap<String, String> mapCityToTeam;
- // standard enum constructor
- private Teams(String city, String teamName) {
- this.city = city;
- this.teamName = teamName;
- }
- /**
- * Retrieves the city this team belongs to.
- *
- * @return this team's city
- */
- public String getCity() {
- return city;
- }
- /**
- * Retrieves the team name.
- *
- * @return this team's name
- */
- public String getTeamName() {
- return teamName;
- }
- /**
- * Retrieves this team as a String, which is just the city name
- * followed by the team name.
- *
- * @return this team as a string
- */
- public String toString() {
- return String.format("%s %s", city, teamName);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment