The phone company is having trouble where bad phone numbers keep appearing under different names. Write a method that will return true
if...
Search Results
Searching for: CS1
Individual Exercises
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...