Question: please solve in java programming language (data structures) Q1 : - Write a class called Cities with the following details : - Attributes: City_No (int),
Q1 : - Write a class called Cities with the following details : - Attributes: City_No (int), City_Name (String), Province (String) Overloaded constructor Ex: Cities (City_No, City_Name, Province) - toString() method to return Cities details (City_No, City_Name, Province) - Write TesthashSet class with main and perform the following operation: - Create 6 Cities objects - Create a HashSet of Cities - Add 6 Cities object to the HashSet. - Print size of HashSet. - Remove a City from HashSet Check if a given City is available in the HashSet or not - Remove another City from HashSet - Print the HashSet using for...in loop - Print the HashSet using Iterator
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
