Define a method that takes an array of
String
s and and achar
c
as input, and returns the longest element of the array that starts with the inputc
. If there is no such element, return an empty string.Define a method that takes two
ArrayList
s and returns anArrayList
containing the greatest element in each position. For example, with inputs{1, 5, 8}
and{3, 2, 11}
, the output should be{3, 5, 11}
. You can assume the inputs will have the same number of elements.Add an instance method called
update(int x)
to the following class so that whenupdate
is called, the object always has the two largest values seen so far contained infirst
andsecond
.public class Big2 { private int first; private int second; public Big2(int first, int second) { this.first = Math.max(first, second); this.second = Math.min(first, second); } }
Write a program that prints all the multiples of 3 or 5 in the range from 1 to 100.
Write a program that reads input until the user types a 0, and then prints the product of all values entered.
Define a class that keeps track of a student and a list of homework grades. Include a method to add a new grade, a method to return the average of all grades, and a method to return a letter grade (using A for at least 90%, B for at least 80%, etc.). Assume all homeworks are graded out of 100.