split(), and an Introduction to Multidimensional Arrays
Due Thursday, December 1 at 11:59 PM
By the time you have completed this work, you should be able to write programs which:
StringExplode.java file, and open it in jGrasp (or a text editor of your choice).
This program will “explode” a
String into an array of characters (
char), and then print out the array.
String comes from the first command-line argument.
Example output with the command-line argument
foo is below:
f o o
StringExplodeTest.javaas a Test File, and Edit It
StringExplodeTest.java file, being sure to put it in the same folder/directory as your
Open this file in jGrasp as a test file, using the same instructions you've used in previous labs.
You need to write a number of tests in this file, and all of them must pass.
The comments in the file provide more details.
MultiSplit.java file, and open it in jGrasp (or a text editor of your choice).
You will need to write a method that will take an array of
String) along with a regular expression, and will call
split() on each one of those
Strings with the given regular expression.
The result of this method should be a two-dimensional array of
You will also need to write a method to print out this two-dimensional array of
main method will call both methods, using “
,” as the regular expression.
Example output is shown below, which corresponds to the command-line arguments
"one,two,three" "alpha,beta,gamma" "delta" "first,second":
0: one two three 1: alpha beta gamma 2: delta 3: first second
The output above shows that the
0th element (
"one,two,three") produced the values
three when a
split with “
,” was performed.
Each subsequent line follows the same general pattern for all the subsequent indicies in the command-line arguments array.
Log into Canvas, and go to the COMP 110 class. Click “Assignments” on the left pane, then click “Lab 16”. From here, you can upload your answers and your code. Specifically, you must turn in the following three files:
In addition, if you collaborated with anyone else, be sure to download
collaborators.txt and write the names of the people you collaborated with in the file, one per line.
Please submit this file along with the other three files.
You can turn in the assignment multiple times, but only the last version you submitted will be graded.