The menu is displayed and the user must select

Assignment Help JAVA Programming
Reference no: EM13164802

Write a Java program 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

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 level 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

This option prompts the user for a filename (from the selected directory) and displays the content of that file on the screen. 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.

6 - Encrypt file (XOR with password)

This option prompts the user for a password (max 256 bytes long) 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

Note1: 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) 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

Note1: 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.

Please provide the bullet proof program

Reference no: EM13164802

Questions Cloud

What is the partial pressure of the helium gas : A gas mixture with a total pressure of 750 contains each of the following gases at the indicated partial pressures: , 253 ; , 120 ; and , 173 . The mixture also contains helium gas.
State the retention time of toluene of benzene : Under a given set of conditions, benzene C6H6 (b.p. 80°C) has a retention time of 60 seconds using a GC column. Under these same conditions, would you expect the retention time of toluene C7H8
What is the empirical formula of putrescine : Putrescine is a compound that is partially responsible for the rotten smell of decaying flesh. It consists of 54.50% C, 13.73% H, and 31.77% N. What is the empirical formula of putrescine?
The basic solutions of the simplex method. : Solve the following problem by inspection, and justify the method of solution in terms of the basic solutions of the simplex method.
The menu is displayed and the user must select : 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.
Compute the concentrations of fe : Calculate the concentrations of Fe3+ and SCN- in the reaction mixture in part I when you add 10.00 mL of 0.200 M Fe3+ to 1.00 mL of 2.0 x 10-3 M SCN- and make up the total volume to 50.00 mL? What is the concentration of FeSCN2+?
Create an er diagram using the set of requirements : Create an ER diagram using the set of requirements provided for Oxford City Council's bicycle sharing scheme and identify the minimal set of functional dependencies and all candidate keys for the relation R
What degrees celsius and pressure of hg occupy : What colume will 500 mL of gas at 20 degrees celsius and a pressure of 420 mm Hg occupy if the temperature is reduced to -80 degrees celsius
Modify the functions for the bisection and false-position : Modify the functions for the bisection and false-position techniques of finding a root of an equation (see below questions) so that the number of iterations can be determined and displayed. (The count should only be displayed after the loop is com..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write the method called print triangle type.

Write the method called printTriangleType. This method accepts three integer arguments representing the lengths of the sides of a triangle and prints the type of triangle that these sides form. Here are some sample calls to printTriangleType

  Write the logical expression in postfix notation.

Given symbols p, q, r, and s for propositions. Draw the binary tree representation of the logical expression ((p || r) && ! p ) || s) && (q || r). Write the logical expression in postfix notation.

  Display student details and classes in applet

Display student details and classes they have enrolled in Applet. The Applet should have following features. Update and View.

  Develop a reliable transfer protocol over udp

Develop a reliable transfer protocol over UDP. Focus on a Stop- and-Wait protocol.

  Write a recursive public method

Write a recursive public method in our BST class that returns a reference to the information in the node containing the smallest value in the tree. The signature of the method is

  Write java programming to show number of credits for course

Write the java programming to solve following problem. We are given a student's marks in Calculus 1, CS1, and Physics 1 (each mark being between 0 and 100) also number of credits for each course.

  Compilation and Execution - JAVA problem

Style marks are based on how your submitted code looks. Remember that good code is easily readable (and understandable) by someone who did not write it. For assignments, you should also include your name, student number, what course this is, what ass..

  Reads contents of two vectors

Write a program that reads contents of two vectors, and then displays the sum of these two vectors. The program should prompt the user to enter the size of the vectors first.

  Write java program to store employee id number

Use employee data file called employees.txt should comprise at least 5 employee records. Each record stores employee ID number (six digits) last name, first name, middle inital,gender(m or f).

  Implement the application using a singly linked list

Implement the following application using a singly linked list. This application accepts from console and stores a list of 10 names of your friends in the singly linked list

  Write jvm program which accepts rpn expression

Write down the IJVM program which accepts RPN expression, with each operand and operator entered line by line. As each number (operand) is entered, push it on stack.

  Compute area and perimeter of a polygon

Create a project that would let a user compute area and perimeter of a polygon

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd