This method takes an ArrayList of Strings as a parameter and returns the longest String in the list. If the list is empty, it should...
Exercises
This method takes an ArrayList of Strings as a parameter and returns the length of the longest String in the list. If the list is empty,...
This method takes an ArrayList of integers as a parameter and does not return anything. The method will expand the list with a mirrored...
This method takes an ArrayList of integers as a parameter and does not return anything. The method will remove all of the odd elements in...
This method takes an ArrayList of integers as a parameter and does not return anything. The method will repeat each odd element in the...
Write a function in Java called factorial(int n)
that will take a positive integer as input and returns its factorial as output. Your...
Write a function in Java called factorial(int n)
that will take a positive integer as input and returns its factorial as output. Your...
Write a function in Java called factorial(int n)
that will take a positive integer as input and returns its factorial as output. You will...
This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at...
Fill in the correct access modifier to make this method only accessible by the class it is in. Return the correct boolean that indicates...
This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at...
What type of error found on line 3?
public static int minVal(int[] y, int first, int last) { int bestSoFar = y[first]; // line 1 for (int...
Based on three scores that the user inputs, display the average of the scores and the letter grade that is assigned fort he test score...
A magic date is one when written in the following format, the month times the date equals the year e.g. 6/10/60. Write code that figures...
Wilson’s Shipping Company charges the following rates:
Weight of Package
Rate per 500 Miles Shipped
2 pounds or less
$1.10
Over 2 lbs...
Suppose you try to perform count on items in this array {1, 4, 3, 7, 15, 9, 24} for item ‘4’. What position is item 4 in this array?
What datatype should you use to store a Middle initial?
What is the value of y after this code has run?
int y = 2; y = 10;
What is the value of variable donuts after the following code executes?
int donuts = 6; donuts = donuts + 3; donuts = donuts * donuts;
Which lines contain the fields?
public class Test { private final int SHIRTS = 24; private int numPants= 14; private int tanks =0; public...
Which lines contain the constructor?
public class Test() { private final int SHIRTS = 24; private int numPants= 14; private int tanks =0;...
What is the scope of the variable spicy?
int peper = 7; int cumin = 17; if ((pepper>5) && (cumin < 20)) { int spicy = 10;...
What is the scope of the variable cumin?
int peper = 7; int cumin = 17; if ((pepper>5) && (cumin < 20)) { int spicy = 10;...
What loop would you use to increase the adult years once the age reaches 18?
Complete the function getArraySize()
so that it returns the size of the array passed in as an argument into the function. You cannot use...