File/directory processing Write a Java, C# or C/C++ program (the choice is yours) for file/directory processing...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
File/directory processing Write a Java, C# or C/C++ program (the choice is yours) for file/directory processing according to the following rules. The program requested for this project must have a text menu like this: 0-Exit 1- Select directory 2-List directory content (first level) 3-List directory content (all levels) 4 - Delete file 5-Display file (hexadecimal view) 6-Encrypt file (XOR with password) 7-Decrypt file (XOR with password) Select option: The menu is displayed and the user must select an option (a number between 0 and 7). The action corresponding to the selection is performed, then the menu is displayed again and the user can choose another option. This cycle is repeated until the user selects 0, which exits the loop and ends the program. The options are: 0-Exit This options ends the program 1 - Select directory The user is prompted for a directory [absolute] name. This is the first options that must be selected by the user. All the options below are working on the directory selected here. After performing several operations on the selected directory, the user can select another directory and work with it. 2-List directory content (first level) This option displays the content of the selected directory on the screen. All the files and sub- directories from the first level must be displayed (files and directories should be listed separately). If no directory was selected an error message must be displayed. 3-List directory content (all levels) This option displays the content of the selected directory on the screen. All the files and sub- directories from the first and subsequent levels must be displayed (files and directories should be listed separately). If no directory was selected an error message must be displayed. 4 - Delete file This option prompts the user for a filename and deletes that file from the selected directory. If no directory was selected an error message must be displayed. If the directory does not contain the file specified by the user, an error message must be displayed. The filename does not include any path, it's just the name of the file. 5-Display file (hexadecimal view) This option prompts the user for a filename (from the selected directory) and displays the content of that file on the screen, in hexadecimal view. If no directory was selected an error message must be displayed. If the directory does not contain the file specified by the user, an error message must be displayed. The filename does not include any path, it's just the name of the file. Note 1: The hexadecimal view displays each byte of the file in hexadecimal; it should look something like this, but simpler. Current Offset Position: 170/483 (30% 00000000 ✔Value preview 56 45 52 53 00 00 00 00 00 00 00 01 54 59 50 45 VAJ 00 00 00 04 00 00 00 01 SS SS 49 44 00 00 00 10 00000020: 5 4C DB 23 87 85 42 A5 AD 88 97 08 88 OD SC DD 45 40 43 45 00 00 00 20 00 00 00 00 00 00 00 DO Data 00 00 00 00 00 00 00 00 00 Offset 00 00 00 57 52 41 0000000 00 00 00 00000000 7K SI ZD Hexadecimal Representation 00 00 00 00 00 00 50 41 40 54 CL 40 D5 36 EZ 00 00 00 04 |00000090: 00 00 27 LO 98 D5 82 48 05 35 42 BD BE 6S CA ADE 58 X6 43 4C 4L 53 000000B0: 00 00 00 04 00 00 00 DB 57 52 41 50 00 00 00 04 00 00 00 03 57 59 00 00 00 28 AD B9 SÅ DE GOODGEDO: 2 66 90 CZ 16 7L 28 94 07 22 RE TE 10000000: FD 18 6 C7 B3 GOODOOYO 13 36 14 Z l00000100: 94 21 SI CL ZZ DC 34 9 30 48 68 8F 89 18 OZ AX DZ 4C 41 53 00 00 04 00 00 00 04 00 00 00 GOODOLLO l00000120: 00 00 00 03 57 50 4B 59 00 00 00 28 38 71 78 81 43 AL 29 11 78 38 17 23 B1 13 53 31 48 P5 94 93 00000140- 27 07 F2 CQ 50 KK CZ 22 x1 74 95 BZ BA AS DA 41 00000150: DE 04 67 69 55 55 49 44 00 00 00 10 28 E3 A8 89 A 21 45 55 83 50 77 BD S 57 58 54 43 40 41 53 00 00 00 04 00 00 00 09 57 52 41 50 00 00 00 04 00000120 Byta: D UUID GOD 8000< HHCK ASCII Representation ·TRUID Do c BOK .20" CLAS UBAJ □)(( 300004 00300 a 6 UUID ** 0! Do? CLAS URAZ WPKY (80- CO => IN O COP OZODA OUID + 0 SYDONLOAD D Word LE Word: 0 Value Preview Dword: 4 LE Dword 67108864 UBAZ Note2: The ASCII representation, the Current Offset and the Value Preview are NOT required; also there is no window, no graphics, no colors, just black and white text display. Being a text only display, you are required to display ONLY the Data Offset and the Hexadecimal Representation. 6- Encrypt file (XOR with password) This option prompts the user for a password (max 256 bytes long, may contain letters, digits, other characters) and then prompts the user for a filename and encrypts the content of the selected file using that password. The encryption method is very simple: just XOR the password with the file content byte after byte; the password being shorter than the file content, you must repeat the password as needed. Example: passwordpasswordpasswordpasswordpasswordpasswordpass this is the file content that we need to encrypt now chiphertext is obtained here by XORing byte to byte Notel: the user must be prompted for the filename of the encrypted file (containing the ciphertext) as well, otherwise we would need to overwrite the initial file. Note2: If no directory was selected an error message must be displayed. If the directory does not contain either of the files specified by the user, an error message must be displayed. The filenames do not include any path. 7-Decrypt file (XOR with password) This option prompts the user for a password (max 256 bytes long, may contain letters, digits, other characters) and then prompts the user for a filename and decrypts the content of the selected file using that password. The decryption method is very simple: just XOR the password with the file content byte after byte; the password being shorter than the file content, you must repeat the password as needed. Example: passwordpasswordpasswordpasswordpasswordpasswordpass chiphertext is here... this is the file content that we had initially Notel: the user must be prompted for the filename of the decrypted file as well, otherwise we would need to overwrite the initial file. Note2: it may seem strange that we are using the same operation (XOR) both for encryption and for decryption, but this is how XOR (exclusive OR) works. Note3: If no directory was selected an error message must be displayed. If the directory does not contain either of the files specified by the user, an error message must be displayed. The filenames do not include any path. Testing: 1. You should use this file as the test file for Display, Encryption and Decryption. 2. For encryption, use the following password "Qwertyuiop[123$4$567]" 3. After encrypting this file with the above password, you obtain an encrypted file of the same length; after decrypting that file with the same password you should obtain an exact replica of this file, and this must be reflected in the Report document by appropriate screenshots showing the content of the files involved in these operations. Deliverables: 1. Source code (zipped) 2. A Report showing the program performing each of the 7 actions correctly (use screenshots), plus screenshots showing the error reporting situations. File/directory processing Write a Java, C# or C/C++ program (the choice is yours) for file/directory processing according to the following rules. The program requested for this project must have a text menu like this: 0-Exit 1- Select directory 2-List directory content (first level) 3-List directory content (all levels) 4 - Delete file 5-Display file (hexadecimal view) 6-Encrypt file (XOR with password) 7-Decrypt file (XOR with password) Select option: The menu is displayed and the user must select an option (a number between 0 and 7). The action corresponding to the selection is performed, then the menu is displayed again and the user can choose another option. This cycle is repeated until the user selects 0, which exits the loop and ends the program. The options are: 0-Exit This options ends the program 1 - Select directory The user is prompted for a directory [absolute] name. This is the first options that must be selected by the user. All the options below are working on the directory selected here. After performing several operations on the selected directory, the user can select another directory and work with it. 2-List directory content (first level) This option displays the content of the selected directory on the screen. All the files and sub- directories from the first level must be displayed (files and directories should be listed separately). If no directory was selected an error message must be displayed. 3-List directory content (all levels) This option displays the content of the selected directory on the screen. All the files and sub- directories from the first and subsequent levels must be displayed (files and directories should be listed separately). If no directory was selected an error message must be displayed. 4 - Delete file This option prompts the user for a filename and deletes that file from the selected directory. If no directory was selected an error message must be displayed. If the directory does not contain the file specified by the user, an error message must be displayed. The filename does not include any path, it's just the name of the file. 5-Display file (hexadecimal view) This option prompts the user for a filename (from the selected directory) and displays the content of that file on the screen, in hexadecimal view. If no directory was selected an error message must be displayed. If the directory does not contain the file specified by the user, an error message must be displayed. The filename does not include any path, it's just the name of the file. Note 1: The hexadecimal view displays each byte of the file in hexadecimal; it should look something like this, but simpler. Current Offset Position: 170/483 (30% 00000000 ✔Value preview 56 45 52 53 00 00 00 00 00 00 00 01 54 59 50 45 VAJ 00 00 00 04 00 00 00 01 SS SS 49 44 00 00 00 10 00000020: 5 4C DB 23 87 85 42 A5 AD 88 97 08 88 OD SC DD 45 40 43 45 00 00 00 20 00 00 00 00 00 00 00 DO Data 00 00 00 00 00 00 00 00 00 Offset 00 00 00 57 52 41 0000000 00 00 00 00000000 7K SI ZD Hexadecimal Representation 00 00 00 00 00 00 50 41 40 54 CL 40 D5 36 EZ 00 00 00 04 |00000090: 00 00 27 LO 98 D5 82 48 05 35 42 BD BE 6S CA ADE 58 X6 43 4C 4L 53 000000B0: 00 00 00 04 00 00 00 DB 57 52 41 50 00 00 00 04 00 00 00 03 57 59 00 00 00 28 AD B9 SÅ DE GOODGEDO: 2 66 90 CZ 16 7L 28 94 07 22 RE TE 10000000: FD 18 6 C7 B3 GOODOOYO 13 36 14 Z l00000100: 94 21 SI CL ZZ DC 34 9 30 48 68 8F 89 18 OZ AX DZ 4C 41 53 00 00 04 00 00 00 04 00 00 00 GOODOLLO l00000120: 00 00 00 03 57 50 4B 59 00 00 00 28 38 71 78 81 43 AL 29 11 78 38 17 23 B1 13 53 31 48 P5 94 93 00000140- 27 07 F2 CQ 50 KK CZ 22 x1 74 95 BZ BA AS DA 41 00000150: DE 04 67 69 55 55 49 44 00 00 00 10 28 E3 A8 89 A 21 45 55 83 50 77 BD S 57 58 54 43 40 41 53 00 00 00 04 00 00 00 09 57 52 41 50 00 00 00 04 00000120 Byta: D UUID GOD 8000< HHCK ASCII Representation ·TRUID Do c BOK .20" CLAS UBAJ □)(( 300004 00300 a 6 UUID ** 0! Do? CLAS URAZ WPKY (80- CO => IN O COP OZODA OUID + 0 SYDONLOAD D Word LE Word: 0 Value Preview Dword: 4 LE Dword 67108864 UBAZ Note2: The ASCII representation, the Current Offset and the Value Preview are NOT required; also there is no window, no graphics, no colors, just black and white text display. Being a text only display, you are required to display ONLY the Data Offset and the Hexadecimal Representation. 6- Encrypt file (XOR with password) This option prompts the user for a password (max 256 bytes long, may contain letters, digits, other characters) and then prompts the user for a filename and encrypts the content of the selected file using that password. The encryption method is very simple: just XOR the password with the file content byte after byte; the password being shorter than the file content, you must repeat the password as needed. Example: passwordpasswordpasswordpasswordpasswordpasswordpass this is the file content that we need to encrypt now chiphertext is obtained here by XORing byte to byte Notel: the user must be prompted for the filename of the encrypted file (containing the ciphertext) as well, otherwise we would need to overwrite the initial file. Note2: If no directory was selected an error message must be displayed. If the directory does not contain either of the files specified by the user, an error message must be displayed. The filenames do not include any path. 7-Decrypt file (XOR with password) This option prompts the user for a password (max 256 bytes long, may contain letters, digits, other characters) and then prompts the user for a filename and decrypts the content of the selected file using that password. The decryption method is very simple: just XOR the password with the file content byte after byte; the password being shorter than the file content, you must repeat the password as needed. Example: passwordpasswordpasswordpasswordpasswordpasswordpass chiphertext is here... this is the file content that we had initially Notel: the user must be prompted for the filename of the decrypted file as well, otherwise we would need to overwrite the initial file. Note2: it may seem strange that we are using the same operation (XOR) both for encryption and for decryption, but this is how XOR (exclusive OR) works. Note3: If no directory was selected an error message must be displayed. If the directory does not contain either of the files specified by the user, an error message must be displayed. The filenames do not include any path. Testing: 1. You should use this file as the test file for Display, Encryption and Decryption. 2. For encryption, use the following password "Qwertyuiop[123$4$567]" 3. After encrypting this file with the above password, you obtain an encrypted file of the same length; after decrypting that file with the same password you should obtain an exact replica of this file, and this must be reflected in the Report document by appropriate screenshots showing the content of the files involved in these operations. Deliverables: 1. Source code (zipped) 2. A Report showing the program performing each of the 7 actions correctly (use screenshots), plus screenshots showing the error reporting situations.
Expert Answer:
Answer rating: 100% (QA)
Here is a Java program that fulfills all the requirements listed java import javaio import javautil public class FileDirectoryProcessor private static File selectedDirectory public static void mainStr... View the full answer
Related Book For
Introduction to Operations Research
ISBN: 978-1259162985
10th edition
Authors: Frederick S. Hillier, Gerald J. Lieberman
Posted Date:
Students also viewed these programming questions
-
Like Death Valley, the Dead Sea is a place where you can walk on dry land below sea level, and an apparently unmotivated hole in the ground along a strike-slip fault. How do you think it formed?
-
Students are asked to rate their preference for one of four video games. The following table lists the observed preferences in a sample of 120 students. State whether to reject or retain the null...
-
Simplify the given expressions. cos5x cos x + sin 5x sin x
-
This case deals with several issues regarding contract formation under the UCC. Logan and Kanawha Coal agreed to purchase coal from Detherage via a fax dated March 9, 2010. The fax stated that it had...
-
Use information on the endpapers of this book to calculate the average density of the Earth. Where does the value fit among those listed in Tables 1.5 and 14.1? Look up the density of a typical...
-
Create a table in excel showing net present value calculation for the following scenario. You will have a column with time period, future value, and present value included. You can anticipate that...
-
(1) Find all pure strategy Nash equilibria of this game. (2) Check the Nash equilibria you find does not have profitable deviations for both players.
-
Echo Industries provides materials for Jason Bradley's engineering firm. Their trade discount is 21%. Rawley's Steel Supply provides similar materials with a trade discount of 20/1. How much is saved...
-
Why do some businesses choose not to export?
-
What does the S-Curve in the product life cycle tell us? a. Products fail because customers perceive some features of these products to be inferior to rival products. b. The R-Curve will always...
-
What are the different attacks against the protocol (IPv4IPv6Routing ProtocolsRemote Access)? How do they work? What are the vulnerabilities being exploited? How are these vulnerabilities being...
-
How much money must you set aside at age 20 to accumulate retirement funds of P100,000 at age 65, assuming a rate of interest of 7% If you deposit P2,000 in a five-year certificate of deposit at...
-
Joe has an amount of money X that he would like to invest in some way. He has two options: He can invest the money in an account that pays an annual effective rate of interest of 9%. Joe would...
-
How many years will it take a $700 balance to grow into $900 in an account earning 5%?
-
Reconsider Prob. 9.3-4, where a swim team coach needs to assign swimmers to the different legs of a 200-yard medley relay team. Formulate a BIP model for this problem. Identify the groups of mutually...
-
Starting from the initial trial solution (x1, x2) = (0, 0), apply one iteration of the gradient search procedure to the following problem by hand: Maximize f(x) = 4x1 + 2x2 + x21 - x41 - 2x1x2 - x22....
-
Consider the following statements about linear programming and the simplex method. Label each statement as true or false, and then justify your answer. (a) In a particular iteration of the simplex...
-
True or False: Annual worth analysis is the most popular DCF measure of economic worth.
-
Consider a palletizer at a bottling plant that has a first cost of \($150,000,\) operating and maintenance costs of \($17,500\) per year, and an estimated net salvage value of \($25,000\) at the end...
-
True or False: Unless non-monetary considerations dictate otherwise, choose the mutually exclusive investment alternative that has the greatest annual worth over the planning horizon.
Study smarter with the SolutionInn App