Create a class University
with final
private instance variables for the name (String
) and
founding year (int
). Create public getters getName()
and getFoundingYear()
and override the
equals()
and toString()
methods.
Two instances of `University` should be equal only if they have the same name and founding year.
The printed representation of a university should be `"Northeastern University (est. 1898)"` if its name is `"Northeastern University"` and its founding year is 1898.
This shows how the class might be used: ```java University nu = new University("Northeastern University", 1898); System.out.println(nu.getName()); // Northeastern University System.out.println(nu.getFoundingYear()); // 1898 University uiuc = new University("University of Illinois Urbana-Champaign", 1867); System.out.println(nu.equals(uiuc)); // false System.out.println(nu.equals(nu)); // true System.out.println(nu); // Northeastern University (est. 1898) System.out.println(uiuc); // University of Illinois Urbana-Champaign (est. 1867) ```
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: