@@ -0,0 +1,1652 @@
+package a2;%0Aimport java.util.Scanner;%0Aimport java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0A/** A subclass of the item class%0A *  Represents a file in the file system%0A *  The file's contents can be modified.%0A */%0Apublic class File extends Item%7B%0A%09%0A%09/** The content of the string */%0A%09private String content = %22%22;%0A%0A%09/** Creates a new file with the given name and parent directory%0A%09 *  @param name String with file's name%0A%09 *  @param parentDIr name of parent Directory%0A%09 */%0A%09//File constructor%0A%09public File(String name, Directory parentDir)%7B%0A%09%09super(name, parentDir);%0A%09%7D%0A%09%0A%09/**add content to current file%0A%09 * %0A%09 * @param content to be added%0A%09 */%0A%09public void addContent(String content)%7B%0A%09%09this.content += content + %22%5Cn%22;%0A%09%7D%0A%09%0A%09/**erase content of current file%0A%09 */%0A%09public void eraseContent()%7B%0A%09%09this.content = %22%22;%0A%09%7D%0A%0A%09/**get content to current file%0A%09 * %0A%09 * @return returns the contents of the file%0A%09 */%0A%09public String getFileContents()%7B%0A%09%09return this.content;%0A%09%7D%0A%09/**%0A%09 * This method takes a regex and looks for the pattern in a file. It returns the line(s) containing the pattern%0A%09 * @param searchWord which represents the REGEX pattern%0A%09 * @return found which represents the line(s) containing the regex%0A%09 */%0A%09public String searchFile(Pattern searchWord)%7B%0A%09    Scanner scanner = new Scanner(this.content);%0A%09    String found = %22%22;%0A%09    while (scanner.hasNextLine()) %7B //now read the file line by line...%0A%09        String line = scanner.nextLine();%0A%09        Matcher m = searchWord.matcher(line); // searches line for the regex%0A%09        if (m.find()) %7B  //if regex in line%0A%09            found += line + %22%5Cn%22 ;%0A%09        %7D%0A%09    %7Dreturn found;%0A%09%7D%0A%0A%7D%0A

Create File.java