Design and write a Java program to read the file system beneath a particular folder, and store it in a tree data structure. Description: Requirements: Your program should be able to look at a folder...

1 answer below »

Design and write a Java program to read the file system beneath a particular folder, and store it in a tree data structure.


Description:



  • Requirements: Your program should be able to look at a folder and its tree of subfolders, and construct a tree data structure to represent it. Each node in your tree corresponds to a folder in the file system, and should contain the number of files, the total size of the files, the folder's name, and a list of child folders

  • Your program should read the name of the folder to scan, scan the folder's subtree, then output the tree in a way that shows the tree hierarchy (e.g., one line per tree node, and indent each node appropriately)

  • Hint: you should use recursion both in the scanning part of your program, and the part that outputs the tree

  • Must execute via a GUI

  • Development process must be documented (commented) within the code.


Submission:



  • PDF document. This PDF will contain your source code and a couple of screen shots showing your program in action pasted into the document.



***** IMPORTANT*****
- IDE being used is intelliJ IDEA version 2022.1- JDK version 17.0.2 is being used

Answered 1 days AfterMay 14, 2022

Answer To: Design and write a Java program to read the file system beneath a particular folder, and store it in...

Arun Shankar answered on May 16 2022
87 Votes
Report 105693
import java.io.File;
import java.util.Scanner;
public class Main
{
static int cou
nt = 0;
private static void countFiles(String dirPath, int indent)
{
for(int i = 0; i < indent; i++)
System.out.print("\t");
System.out.print(dirPath + " ");
System.out.print(count);
File f = new...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here