Question: Question 2 10 pts Write a recursive method called createPath that takes an integer and a string parameter. The integer parameter represents the depth of
Question 2 10 pts Write a recursive method called createPath that takes an integer and a string parameter. The integer parameter represents the depth of a folder inside a file structure and the string parameter represents the name of a file. The method should return a String constructed to represent the number of folders it takes to reach the specified file. If the integer parameter is 0, the file exists at the current level and thus no folder structure is needed For example: Method Call Returns createPath(O. "something.txt") "something.txt" createPath(1. "something.txt") "folder1/something.txt" createPath(2. "something.txt") "folder 1/folder2/something.txt" createPath(3, "data.log") "folder 1/folder2/folder3/data.log" You are not allowed to construct any structured objects other than Strings (no array, ArrayList, StringBuilder. Scanner, etc) and you may not use a while loop, for loop or do/while loop to solve this problem: you must use recursion Edit View Insert Format Tools Table D A eu TV
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
