(Recursion (Recursion (Recursion (Recursion))))
Shell.javaThis file was used in previous assignments. (Do not modify)
Recursion.java. This defines the interface of the
publicmethods you will write. It also contains code for testing your methods. (Do not modify)
MyRecursion.java. This is the file you will complete. It is likely that you will write additional
privatehelper methods to complete the work. No java loop constructs are allowed in this file! All work must be done using recursion . Nor may you add additional classes with methods that use loops. You may not use the
SampleFile.java. This is a simple program to show you how to use several methods of the
Fileclass that you will use in your assignment. You will not actually use this class in your solution, but you should compile and run it to understand how to do various operations on files and directories.
Here is the documentation for the classes. Study the documentation for details on how to complete your implementation.
Save target as ...to save this file in your project.
SampleFileclass and run it to see it works.
repeat()method. This is a simple problem of replacing a loop by recursion. Look at how this is done in the lecture notes. Test it using
list()method. Again you will be doing work using recursion. This time you will be dealing with an array of data. This is a learning experience for later on.
contains()method. This will be quite similar to the
list()except it will check if each element matches the one being searched for.
intersect()method. You should find that the
contains()method is useful here.
diamondmethod. Look at the symmetry of the output (horizontal and vertical) and see if you can exploit that.
directory()method. This will combine calls to various recursive methods.
MyRecursion.javausing the Checkin tab of the course website. Alteratively, at a terminal, type
~csXXX/bin/checkin XXX MyRecursion.java.