This is what the output will look like in one case:
Enter a string: ab Enter another string: babacbabdabfab ab is a substring of babacbabdabfab and occurs 4 times.This is what the output will look like in another case:
Enter a string: er Enter another string: reabear er is not a substring of reabear
The file that you will be turning in will be called SubString.java. You will follow the standard Java coding convention that I have appended below. The file will have a header of the following form:
/* File: SubString.java Description: Student Name: Student UT EID: Course Name: CS 303E Unique Number: TA: Date Created: Date Last Modified: */
public static String sortString ( String s )
In the method sortString() you can convert the string into an array of characters. Sort the array of characters using the Selection Sort algorithm discussed in class. Then convert the sorted array of characters to a String and return that String. Remember that characters have integer representations and can be compared using the relational boolean operators just like integers.
The file that you will be turning in will be called SortString.java. You will follow the standard Java coding convention that I have appended below. The file will have a header of the following form:
/* File: SortString.java Description: Student Name: Student UT EID: Course Name: CS 303E Unique Number: TA: Date Created: Date Last Modified: */
You will follow the standard Java Coding Conventions. You can either view the HTML page or download the PDF or Postscript and print it out. There is a modification that I would like to make to the standard coding conventions. Please align the opening and closing braces vertically so that you can easily make out the blocks of code.
Use the turnin program to submit the files SubString.java and SortString.java. The TAs should receive your work by 11 PM, Monday, 12 April 2004.