| Constructor and Description |
|---|
AssignX() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
divides(int numerator,
int denominator)
Determine if the denominator evenly divides the numerator.
|
abstract int[] |
findMultiples(int[] list,
int denominator)
Find all elements of the list that are evenly divisible by the denominator
|
abstract int[] |
merge(int[] list1,
int[] list2)
Merge two sorted lists to produce a sorted list containing all the values
from both lists.
|
void |
processOneCommand(java.lang.String cmd,
java.lang.String params)
Process one command for this assignment.
|
void |
showHelp()
Display a list of commands useful for testing the classes you will
complete for this assignment.
|
abstract void |
trio(java.lang.String[] list)
Given a list of names, print out all combinations of the names taken
three at a time.
|
abstract void |
wordCount(java.lang.String fileName)
Count the number of words and the number of lines in a file.
|
debug, filter, format, getIntArray, getRandom, getStrArray, getStringOrNull, main, ooMain, processCmdsFromFile, processCommands, processCommands, rest, strArrayToIntArraypublic abstract boolean divides(int numerator,
int denominator)
numerator - - any integerdenominator - any integertrue if denominator evenly divides
numerator. Otherwise, return false.public abstract int[] findMultiples(int[] list,
int denominator)
list - - an array of integer valuesdenominator - any integerdenominator. The values
in the returned list must be in the same order as the values occur
in the parameter list.public abstract void wordCount(java.lang.String fileName)
wc command from a terminal shell.fileName - - the name of the file to process.public abstract int[] merge(int[] list1,
int[] list2)
java sort methods. If either of the
lists is null, return the other list as the answer.list1 - - an array of sorted valueslist2 - - another array of valuespublic abstract void trio(java.lang.String[] list)
Kennedy,
Johnson, Nixon, Ford, you program prints:
[Kennedy, Johnson, Nixon] [Kennedy, Johnson, Ford] [Kennedy, Nixon, Ford] [Johnson, Nixon, Ford]
Put the values in an array and then use the
Arrays.toString() method to print the results, one per line.
list - - a list of name.public void showHelp()
public void processOneCommand(java.lang.String cmd,
java.lang.String params)
throws java.io.FileNotFoundException,
java.util.NoSuchElementException
processOneCommand in class Shellcmd - - the command to processparams - - a string containing the parameter(s) (if any)java.io.FileNotFoundExceptionjava.util.NoSuchElementException