Class LP1
java.lang.Object
LP1
Glorious Lab Practical on Java
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringThis plucks out entries of a string at indices divisible by p.static LocalDatedaysFromNow(int n) This finds the date n days from today.static StringThis makes a string echoy.static intThis computes the product of the non-zero elements of a and returns the sum of its digits.static voidHere is your testing ground.pseudoGrep(ArrayList<String> al, String s) This filters strings for a specified substringstatic BigIntegersum(ArrayList<BigInteger> a) This computes the sum of a list of BigIntegers
-
Constructor Details
-
LP1
public LP1()
-
-
Method Details
-
sum
This computes the sum of a list of BigIntegers- Parameters:
a- an array list of BigIntegers- Returns:
- the sum of the BigIntegers in a
-
aerate
This plucks out entries of a string at indices divisible by p. in a string.- Parameters:
s- a stringp- a nonnegative integer.- Returns:
- a string that has entries p, 2p, 3p, etc of the string s. Examples: aerate("aardwolf" 2) -> "arwl" aerate("bacchanalia" 3) -> "bcni"
-
echoy
This makes a string echoy. See the example- Parameters:
s- is a string- Returns:
- a string with the nth character repeated n times. example: echoy("cowpie") → coowwwppppiiiiieeeeee if the string passed is empty, return an empty string
-
finger
This computes the product of the non-zero elements of a and returns the sum of its digits.- Parameters:
a- an array list- Returns:
- the sum of the digits in the product of the non-zero entries in a
-
pseudoGrep
This filters strings for a specified substring- Parameters:
al- is an array list of strings.s- is a search string- Returns:
- an array list of striings containing all those strings
in the array list
alhavingsas a substring.
-
daysFromNow
This finds the date n days from today. If n is negative find the date -n days ago.- Parameters:
n- the number of days from today- Returns:
- the date n days from today. Sample: 10000 days from this lab prac is 29 March 2049. Today is 11 November 2021 Sample: 10000 days ago is 1994-06-26
-
main
Here is your testing ground.- Parameters:
args- command-line arguments. You won't have any.
-