Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a method void listAllFiles(File dir) that recursively displays a list of a directory's files and subdirectories. An example is illustrated below. Note the following

Write a method void listAllFiles(File dir) that recursively displays a list of a directory's files and subdirectories. An example is illustrated below. Note the following in the output:

Directory names are all capitalized and written between brackets [ ].

Files and subdirectories are indented in order to illustrate to which parent directory they belong. Use a helper method void listAllFiles(File dir, String spaces) where dir represents the root directory (i.e., Folder 1 in the example below) and spaces stores a number of spaces " " that is incremented every time the method is recursively called. The helper method should print out spaces followed by the file or

subdirectory names.

image text in transcribed

Folder structure on the hard drive DL Computer Local Disk (c) 4 4 Folder 1 Folder X Folder A Folder B Folder Y OUTPUT from your Java Program for "Folder 1" [FOLDER 1] file 1.pdf file 2.pdf [FOLDER X] file 1.pdf file 2.pdf file 3.pdf [FOLDER AJ file 1.pdf file 2.pdf [FOLDER BJ file 1.pdf file 2.pdf [FOLDER Y] file 1. file 2.pdf

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

ISBN: 0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago