Question: Review Lab 0, City class coding Submitting work for credit before 1125. Solutions will be given on 1/25 The class must implement Comparable interface Class

Review Lab 0, City class coding Submitting work for credit before 1125. Solutions will be given on 1/25 The class must implement Comparable interface Class city has three variables: name, state (of type String) and population (of type int) It has the three-variable constructor taking in parameters for publis city (String n, String s, int p) name = n; state population p; Define all three getters and the setter for field population Additionally, implement equals and compareTo methods as follows: RabiS int sompareTe (City st) f int temp = state. compareTo (cts tate); LE (temp != 0) return temp ; else return name compareTo (ct.name); Rublig boolean equals (Object obi) f City ot= (City) obj; return. this.compareTo(et) -0: You need also implement tostring method to provide a meaningful description of a city of known name, state and population
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
