Question: Folder System: You will implement a Folder class that represents a folder in a simplified file system. Each folder can contain files ( represented as
Folder System:
You will implement a Folder class that represents a folder in a simplified file system. Each folder can contain files represented as strings and other subfolders aka Folder Class objects You will implement recursive methods to calculate the total number of files, compare folder contents, and display the folder structure. This project should also include a flow chart in addition to the algorithm.
The Folder Class will have the following attributes. The folders name as a string it will also have a list that can hold "files" represented as strings, and lastly the folder class will have a list of "subfolders Folder objects
Your Folder class should contain the following methods which are accessible from a menu.
addfile: Which will take a file name and add it to the folder.
addsubfolder: Adds a subfolder another Folder object to the current folder. All folder names should be unique.
selectfolder: Takes a folder name and makes that the current open folder from which methods will start from.
countfiles: Recursively counts the total number of files in the folder and all its subfolders. This method should also be private.
eq: Compares a folder and a string. They are equal if they have the same folder name.
len: Returns the total number of files in the folder and all its subfolders.
str: Returns a string representation of the folder, showing the folder name, its files, and its subfolders, using indentation for nested subfolders. There should be a menu item to print a folder.
Example Output:
Menu
Current Folder: Start Folder
add File
add Folder
select Folder
print Folder
input:
input Folder
Name: hello Folder
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
