Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Java program that analyzes a folder of input files and produces the output into multiple other files. The program must retrieve the paths

Create a Java program that analyzes a folder of input files and produces the output into multiple other files. The program must retrieve the paths to every .java and .txt file in the hierarchy. Once all the paths to the files are found the program must figure out the length of the longest line. For example, working with an input file called MainFile.java. Once it figures out the longest line it will put the output into MainFile.java.stats and it will be located in the same directory. This program will also be able to able to analyze all the other files in the folder, not just MainFile.java. So, if Data.java is also in the folder the longest line length will be outputted in Data.java.stats. It doesn't matter what the contents of the .java file is as long as the output is correct in the .java.stats file. You can use your own .java files and folders to figure this program out. You must use List lines = Files.readAllLines(filePath, Charset.defaultCharset()); to find all the files in a folder. And you must use void writeToFile( Path location, List toWrite ){ Files.write(location,toWrite,Charset.defaultCharset()); } to create the output text. Please use both of the bolded code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

Explain the factors influencing consumer behaviour.

Answered: 1 week ago