Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


C++ Application Development Assignment – 1

File System


Practical Work

By using Microsoft Visual Studio Community 2019, develop an object-oriented console application of file system, which can display the names of folders and files, and perform operations on filenames, such as creating a new filename or deleting an existing filename (since this is only a conceptual application, we are merely dealing with filenames instead of real files). You are given three text files, which are named "namesFolder", "IOS", and "WINDOWS". "namesFolder" stores folder names in this file system; "IOS" stores the filenames in the folder named IOS, and "WINDOWS" stores the filenames in the folder named WINDOWS. You can prepare and check the contents of these three files using a word processing tool such as Notepad, Word or WordPad. The developed file system application should be able to read the contents from these three files. It can display all the folder names as well as all the filenames in each folder. An example is shown below, where "WINDOWS" is the name of the first folder (folder 0), and "IOS" is the name of the second folder (folder 1). As shown below, there are 6 filenames in the first folder and 5 filenames in the second folder. You do not need to follow this style; for example, you can also display the filenames in each folder differently, but you must have a way to display all the filenames and their corresponding folder names.



While you are responsible for the final design of this console application of file system, your application is expected to contain a class called myFileSys, which stores 1) the number of folders, 2) the folder names, 3) the number of files in a folder, and 4) the filenames in a folder.


You can use multidimensional arrays to store the filenames and folder names. For example, you can use "char fileName[100][100][100]" to store the filenames in different folders. Then, fileName[i][j][k] is the k-th character of the j-th file’s filename in the i-th folder. In this way, fileName[i][j] stores the j-th file’s filename in the i-th folder. You can use "char folderName[100][100]" to store the folder names. In this way, folderName[j][k] stores the k-th character of the j-th folder name. Then, the number of folders in a myFileSys object tells whether the record j in folderName[j] is a valid record. The number of files in a folder in a myFileSys object tells whether the record (i, j) in fileName[i][j] is a valid record. Notice that this number of files in a folder is an integer array. For example, "int numFileFolder[100]" stores the number of files in folder 0 in numFileFolder[0], the number of files in folder 1 in numFileFolder[1]. You can assume that the array size 100 is always large enough. You can also assume that any name contains no space, so that you can always use cin to read char strings instead of using cin.getline().


Within the class, apart from the public member functions for displaying the names of files and folders, it should also be able to perform extra tasks on filenames. You are required to develop public member function(s) to realise one of the following five tasks. Your task should be determined by the remainder obtained from dividing your team number by 5. For example, if your team number is SEVEN, 7%5 = 2, and you should do Task 2) of this assignment. Notice that all the tasks below do NOT require you to save the changes into the 3 text files. For simplicity, as the task below does not work with folders, when doing the tasks, you can assume that the folder names or folder indexes are always valid, i.e., you don’t need to check whether a folder name exists or whether a folder index is valid. You may assume there are just two folders: "WINDOWS" and "IOS".


Task:

0) The member function adds a new filename to a specific folder. It should ask for the input of a source folder (e.g., the folder name or the folder index i such as 0 or 1; it depends on your design) and the input of the filename. It must check whether the input filename exists in the source folder or not, and add the filename only when that filename does not exist. If the operation is successful, when your application displays all the filenames in that source folder, the newly added filename should appear.

1) The member function deletes an existing filename from a specific folder. It should ask for the input of a source folder (e.g., the folder name or the folder index i such as 0 or 1; it depends on your design) and the input of the filename. It must check whether the filename exists in the source folder or not, and delete the filename only when that filename exists. If the operation is successful, when your application displays the filenames in the source folder; the deleted filename should NOT appear.

2) The member function renames an existing filename in a specific folder. It should ask for the input of a source folder (the folder name or the folder index i such as 0 or 1; it depends on your design) and the input of the filename. It must check whether the filename exists in the source folder or not, and rename the filename only when that filename exists. If the operation is successful, when your application displays the filenames in the source folder, the modified filename should be displayed instead of the original filename.

3) The member function copies an existing file from a source folder to a destination folder. It should ask for the inputs of the source folder and the destination folder (e.g., the folder indexes i and j such as (0, 1) or two folder names; it depends on your design) and the input of the filename. It must check whether the filename exists in the source folder and whether the filename exists in the destination folder. It performs the "copy" operation only when the filename exists in the source folder and does NOT exist in the destination folder. If the operation is successful, when your application displays the filenames in the source folder and destination folder, that filename should appear.

4) The member function moves an existing filename from a source folder to a destination folder. It should ask for the inputs of the source folder and the destination folder (e.g., the folder indexes i and j such as (1, 0) or two folder names; it depends on your design) and the input of the filename. It must check whether the filename exists in the source folder and the destination folder. It performs the "move" operation only when the filename exists in the source folder but does NOT exist in the destination folder. If the operation is successful, when your application displays the filenames in the source folder and destination folder, that filename should not appear in the source folder but should appear in the destination folder.

● It is required that the class and the implementation of its member functions should be built as a separate static library and linked into the console application.

● Your console application is expected to provide a text-mode user interface so that users can repeatedly display the folder names, filenames in a folder, and do the specific task of your team on filenames above; until the user chooses to end the application.

● Should you want to get a credit, you should implement a new public member function, which performs a filename search. This function should ask for the input of a character string (i.e., a query string), and find out all the filenames that match with the query string and their corresponding folder indexes or names. For simplicity, you can assume the query string contains no space. For example, if you have a file named "abc100" in some folder, and you input a query string "abc", then "abc100" should be found out and shown, and its folder index or folder name should also be shown. However, if you input a query string "abc2" or "bc2" or "abc1001", then "abc100" should NOT be found out, and a message indicating a no matching should be shown.

● Should you want to get a distinction, you should implement a new public member function to save all your changes made to the filenames to the text files of "namesFolder", "IOS", and "WINDOWS", so that next time when you open the console application again, you have the updated file system.


Report

Your report should include:

1. Abstract: Summarise the objectives and achievement of your assignment in less than 100 words.

2. Introduction: Describe the assignment's objectives and requirements in detail and give a brief account of the methodology.

3. Methodology: It contains

● How your team divides the work among the team members. It will be used as a reference for assessment.

● The schedule and steps of developing the project

● The detail of the developed application, including

■ The specifications of the classes defined, and the public/private member functions/variables inside

- explain as far as possible why your group makes such choices for the class members

■ The flow of execution. (It is good to include a flow chart to help illustration.)

● The problems your group encounters, and how your group solves the problems

● The way to validate your application, i.e., confirm that the solution is correct.

4. Results

● Include the results of executing your program captured from the screen.

5. Conclusion and further development

● Summarize the experience gained in the assignment

● Indicate how your program can be extended and improved if more time is allowed.


The report should be in PDF format with your class number, team number, student names, student IDs, and task number on the front page. It is NOT required to include the complete source code in the report. Instead, you should zip the folder(s) containing all your project folders and files (including your report file) into a zipped file for submission. (See the General Description below.)


General Description

1. Each team should comprise THREE students. Students must obtain prior approval from the subject lecturer if they want to form a team with fewer or more team members.

2. Unless you get prior approval from your subject lecturer/tutor, you must observe the following:

● Do NOT use any technique or C++ constructs not taught in the subject

● Unless mentioned on this instruction sheet, any library function not mentioned in the subject must NOT be used.

3. Each team should upload the zipped file to the Blackboard (under Groups, select File Exchange after clicking your team number) on or before 27 Nov. 2021.

4. Ensure your submitted code can be successfully built using Visual Studio Community 2019. The developed application can run in Command Prompt on any PC with Windows 10. Assessment will only be made based on your submitted zipped file. To lower the chance of incomplete submission, you are advised to zip one whole folder that contains all folders and files of the projects for this assignment.

5. The documentation for your assignment is important. Your ability to write good comments for the source code will also be an important factor in the final assessment of your assignment.

6. It is compulsory to use a word processing tool to write your report. The font size must not be bigger than 12 or smaller than 10. Use 1.5 lines spacing on both sides of a page. Including all figures and tables, if any, the length of the report should not be shorter than 7 pages.