there is a folder named Data

List all the directories, subdirectories and files present at a path. You should assume that there is a folder named Data which will be available in the same directory as your java file and will contain all the files that you must process. You should open a file named “log.txt” and write the detailed file structure present in the Data folder in it. You must take the recursive approach to list all files and directories present in the Data folder. For example, a sample log of directory system is shown in figure 1. You must use exception handing while using the File class. 1. Directory: C:Users AdminDocumentsEclipseworkspaceAssignment3Data2017 Files c:Users AdminDocumentsEclipseworkspaceAssignment 3Data20171. txt C:Users AdminDocuments Eclipseworkspace Assignment3 Data 2017102.txt C:Users AdminDocumentsEclipseworkspaceVAssignment3Data 2017 03.txt C: UsersAdmin Documents Eclipseworkspace Assignment3 Data 2017 1 04.txt c:users AdminDocuments Eclipseworkspace Assignment3 Data 2017 05. txt c:users AdminDocuments Eclipseworkspace Assignment3Data 2017 06.txt C:Users AdminDocuments Eclipseworkspace Assignment3 Data2017 07. txt C: UsersAdmin Documents Eclipseworkspace Assignment3 Data 20171 08. txt C:Users AdminDocuments Eclipseworkspace Assignment3 Data 2017109.txt C:Users AdminDocuments Eclipseworkspace Assignment3 Data2017 10.txt C:Users Admin Documents EclipseWorkspace Assignment3Data 2017 11.txt C: Users Admin Documents Eclipseworkspace Assignment3 Data 2017 12.txt C:users AdminDocuments Eclipseworkspace Assignment3 Data2017 13. txt C:users Admin Documents Eclipseworkspace Assignment3Data 2017 14.txt C:NuscrsAdminDocumcnts Eclipscworkspace Assignment3 Data2017 15. txt c:users AdminDocuments Eclipseworkspace Assignment3 Data 2017 16. txt C:Users AdminDocumentsEclipseworkspace Assignment3Data 2017 17.txt C:Users AdminDocuments Eclipseworkspace Assignment3 Data2017 18. txt c:Users AdminDocuments Eclipseworkspace Assignment3 Data 2017 19. txt C:UsersAdminDocuments Eclipseworkspace Assignment3Data 2017 20. txt C:Users AdminDocuments Eclipseworkspace Assignment3 Data2017 21.txt c:Users Admin Documents Eclipseworkspace Assignment3 Data 2017 22. txt C:Users Admin Documents EclipseWorkspace Assignment3Data 2017 23.txt C: Users Admin Documents Eclipseworkspace Assignment3 Data 2017 24.txt C:users AdminDocumentsEclipseworkspaceAssignment3Data201725.txt Directory C:Users AdminDocumentsEclipseWorkspaceAssignment 3Data 2018 Files C:Users AdminDocumentsEclipseworkspaceAssignment3Data201826. txt C:NUsers AdminDocuments Eclipseworkspace Assignment3 Data2018 27.txt c:users AdminDocumentsEclipseworkspaceAssignment3Data201828.txt Figure 1. A sample directory structure and corresponding log file 2. The program should provide three options to users. (1) List files, (2) Process files, and (3) Exit First option will create the “log.txt” file and second option will open “log.txt” and all the files logged in will be processed as described below. If a file named “log.txt” is already present, you must overwrite its contents. The third option will exit the program. You MUST however, close all opened files before exiting the program 3. Write two custom exception classes called InvalidFileException and EmptyFolderException. The first one responsible to make sure the log file is valid and the file paths in it are valid. The second one will be responsible for checking for empty directories. They must have constructors to allow a default error message “Error: Input file named XXX cannot be found. They should also allow for a custom message to be set as error message. All the exceptions should be logged and the files which are valid must be processed. 4.Processing phase of this application will iterate through the log file, if its exists, in the following manner: A.Go through each subdirectory inside the folder named “Data” and read all the text files one by one. a. B. From each text file you should extract CarMake and cost information which you will use to produce a report in below depicted format carMake TotalCost NumberofCars SRNO Ford $100,000 $80,000 $95,000 $78,000 $45,000 1 2 3 4 5 3 BMW Honda 5 2 1 BMW Audi Figure 2. A sample report file produced by the Java program C.Create a random access file to maintain a record of aggregated data grouped by car make This file will contain the information extracted from the text files processed so far. Every time a text file is processed you will modify contents of this file. For instance, if the new file provided data on Ford, you will modify number of cars and total cost column for that row. You may map the car make info to row numbers in advance c. Finally, here are some general information: 5. A.It may assist you greatly if you take advantage of static variables/attributes and static attributes throughout the assignment; in fact, it is not necessary to utilize other aspects such as Inheritance, Polymorphism, etc B. You must use recursion for creating file structure log C.You should minimize opening and closing the files as much as possible; a better mark will be given for that D.Do not use any external libraries or existing software to produce what is needed; that will directly result in a 0 mark! D. Again, your program must work for any directory structure as long as the root directory is present in the same directory as your java file and is named “Data”. The files provided with this assignment are only one possible version, and must not be considered as the general case when writing your code C. e. amunN

 

g