Write a program that prompts the user to enter a directory and displays the numb
ID: 664174 • Letter: W
Question
Write a program that prompts the user to enter a directory and displays the number of the files in the directory. (String permutation) Write a recursive method to print all the permutations of a string. For example, for the string abc, the permutation is (Hint: Define the following two methods. The second is a helper method.) public static void display Permutation( String s) public static void display Permutation(Strings 1, String s2) The first method simply invokes display Permutation(, s). The second method uses a loop to move a character from s2 to s1 and recursively invokes it with a new s1 and s2. The base case is that s2 is empty and prints s1 to the console. Write a test program that prompts the user to enter a string and displays all its permutations?Explanation / Answer
import java.io.File; public class ListFiles { public static void main(String[] args) { // Directory path here String path = "."; String files; File folder = new File(path); File[] listOfFiles = folder.listFiles(); for (int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.