@@ -0,0 +1,1241 @@
+package a2;%0A%0Aimport a2.Directory;%0Aimport a2.File;%0Aimport a2.Item;%0A%0A/**A subclass of item class.%0A * Represents a directory in the file system.%0A * The directory's contents can be viewed .%0A */%0Apublic class Directory extends Item%7B%0A%09%0A%09/** Creates a new directory with the given name and parent directory.%0A%09 *  @param dir String with directory's name%0A%09 *  @param parentDIr name of parent Directory%0A%09 */%0A%09//Directory constructor%0A%09public Directory(String dir, Directory parentDir)%7B%0A%09%09super(dir, parentDir);%0A%09%7D%0A%09%0A%09/**%0A%09 * Get sub directories with the same name as name.%0A%09 * @param name: name of directory we want to get%0A%09 * @return return the directory if it exists, return null if it does not exists%0A%09 */%0A%09public Directory getSubDir(String name) %7B%0A%09%09for (Item i : this.subItems) %7B%0A%09%09%09if (i instanceof Directory && i.getName().equals(name)) %7B%0A%09%09%09%09return (Directory)i;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%0A%09/**%0A%09 * Get sub files with the same name as name.%0A%09 * @param name: name of file we want to get%0A%09 * @return return the File if it exists, return null if it does not exists%0A%09 */%0A%09public File getSubFile(String name) %7B%0A%09%09for (Item i : this.subItems) %7B%0A%09%09%09if (i instanceof File && i.getName().equals(name)) %7B%0A%09%09%09%09return (File)i;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%7D%0A

Create Directory.java