Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Java program that analyzes a program and produces the output into another file. The program must retrieve the path to the .java file.

Create a Java program that analyzes a program and produces the output into another file. The program must retrieve the path to the .java file. Once the path to the file is found the program must figure out the length of the longest line is in the program. For example, working with a program called MainFile.java. Once it figures out the longest line in the code it will put the output into MainFile.java.stats and it will be located in the same directory. 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()); iterate through the list of strings. And you must use void writeToFile( Path location, List toWrite ){ Files.write(location,toWrite,Charset.defaultCharset()); } to create the output text which will be MainFile.java.stats. Please use both of the bolded code exactly how it is to figure out this program. There is another solution on the website; however, it is not what I was looking for.

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

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions