In math, multiplying a matrix by a single number is straightforward. For example, if you had a 2D array of ints
int [][] numbers = { {1,...
Searching for: CS1
In math, multiplying a matrix by a single number is straightforward. For example, if you had a 2D array of ints
int [][] numbers = { {1,...
The following method takes in an int
representing some number of inches. Implement it so that it returns a string reporting the number of...
The following method takes in a 2D character array. Somewhere in that array, there may be one '*'
character. This method should find that...
The following method will appear in a class with a generic type parameter T
. It takes in a 2D array of elements of that generic type T
,...
This Answer
class stores an integer called value
as a field. However, something is wrong with the constructor and it is not working...
This method returns the sum of ages stored in a 1-dimensional array. For example if ages
contains {24, 12, 32, 56}
, this method should...
The Rectangle
class below has two integer fields to store its length
and width
. The toString()
method should do the following:
The method below returns the product of numbers from 1 to i
. For example, product(4)
should return 24 (or 1 * 2 * 3 * 4). However,...
This Person
class stores a String name
and an int id
. However the toString()
method is not working correctly. The toString()
method...
The following Dog
class stores a String name
and an integer numSpots
that represents how many spots the dog has on its fur. It also...
A teacher is creating an answer key to a true/false quiz. They need a map that can store an integer question number and the corresponding...
Create a Map that can store Integer
ID numbers that will map to String
name values. Create a Map
object that can store such data. You...
For this question, you can assume you have access to a class called Pet
that stores all of the data that applies to a specific pet (name,...
A teacher is creating an answer key to a true/false quiz. They need a map that can store an integer question number and the corresponding...
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...
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.
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...