Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please solve in java programming language (data structures) Q1 : - Write a class called Cities with the following details : - Attributes: City_No (int),
please solve in java programming language (data structures)
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started