Add the numbers 0 to 9 to the set passed in as a parameter, and then return the set.
Exercises
The soccer team is using a Map
to track which students have or haven't submitted their medical records. The map is using team member's...
Complet this method to Add the numbers 0-9 as keys to the map. If the key is even, the value for that pair should be true
. If the key is...
The following Map
should have 7 entries, with a string key for every day of the week. Each value should be a double that represents the...
Write a method that takes a key and an associated value as parameters, and will only add them as anew entry in the map if the key is not...
Due to a coding problem at the phone company, Jane M's name keeps getting added to the no call list when she should not be there. Write a...
The phone company is having trouble where bad phone numbers keep appearing under different names. Write a method that will return true
if...
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...
The method below takes in a map of integer key/value pairs. Create a new map and add each key from the original map into the new map,...
The method below takes in a set of String names of students. Below, use this set names
to create a map (either HashMap or TreeMap is...
A teacher is tracking grades for two sections of a class using two maps. Each map uses the student's name as a key with their grade is...
In the previous exercise, you took two maps and turned them into one larger map. Now the teacher wants to take that larger map and create...
The method below takes in two integers as parameters and should throw an IllegalArgumentException
if either parameter is the number 5. In...
The method below takes an array of Jeroos and should throw an exception if any Jeroo in the array is null
or if any is facing North.
In...
The method below takes in a String parameter representing a username. It should throw an Exception
if the username is less than 3...
The method divideValues()
will throw an IllegalArgumentException
if either parameter is 5. The method below takes two integer values as...
The validateJeroo()
method takes in an array of Jeroo objects and could throw two different exceptions.
If a Jeroo in the array is null,...
The following code runs a method called validateUser()
that will throw an IllegalArgumentException
if a username (passed in as a...
A graph with relatively few edges is called: