Create a Set
that can hold a series of ages. All ages will be whole numbers (meaning no decimal point) represented as Integer
values. You...
Search Results
Searching for: sets
Individual Exercises
For this question, create a Set
that can hold a set of names (ex. "Heather"). You do not need to add any values to the set, just create...
For this question, create a Set
that can hold a series of temperature values. All values will have a decimal point (no integers). You do...
The following method takes in a set of boolean values. Add both true
and false
to the set, and then return it.
The method below takes in a Set called strSet
and a string representing a person's name. Add the parameter name
to strSet
, then return...
Add the numbers 0 to 9 to the set passed in as a parameter, and then return the set.
Write a method that will return true if the parameter value
is in both of the given sets. Try to use only one line of code in the method....
Write a method that returns true
if all values in the given array are in the given set. If any value from values
is not in numberSet
,...
Write a method that will return a string indicating whether or not the double value
is in doubleSet
. For example if dSet
contained {4.5,...
A teacher is using a set to track the names of the students in their class. However, some students have decided to drop the class. Write...
The set passed in as a parameter contains all integer values from 1 to 50 (inclusive--so 1 and 50 are both in the set). Remove all even...
Sometimes, rather than remove a single item we may want to remove many items with a single method call. The method below takes in a set...
The method below takes in two sets of integer values called setA
and setB
. Create a new set of integers, then add any value that is in...