Question: Integer setSize is read from input, followed by setSize integers that are added to HashSet ageDatabase. Then, integer eliminateAge is read from input. If eliminateAge

Integer setSize is read from input, followed by setSize integers that are added to HashSet ageDatabase. Then, integer eliminateAge is read from input. If eliminateAge exists in ageDatabase, remove eliminateAge from ageDatabase and output "Successfully eliminated". Otherwise, output "Age not encountered".
End each output with a newline.
Ex: If the input is:
41489781614
then one possible output is:
Old set: 14897816 Successfully eliminated New set: 897816
Note: The order of the keys is not guaranteed in a HashMap.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!