Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

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 XXXXXXXXXXJDK version XXXXXXXXXXis being used
Answered 1 days After May 14, 2022

Solution

Arun Shankar answered on May 16 2022
102 Votes
Report 105693
import java.io.File;
import java.util.Scanner;
public class Main
{
static int count = 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