The user is prompted for a file name


This is to b e done in java: 
The program requested for this project must have a text menu like this:

0 - Exit
1 - Select file
2 - Display
3 - Rename
4 - To upper case
5 - To lower case
6 - Reverse each line
7 - Reverse the whole file

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. We may assume we are working with text files only. The maximum length of the file is 20000 (tewnty thousand) characters. All your code must be in one single file, say "p2.c" or "p2.java". The executable should be named "p2". Programming can be done in C/C++ or JAVA.

The options are:

0 - Exit
This options ends the program

1 - Select file
The user is prompted for a file name. This is the first options that must be selected by the user. All the options below are working on the file selected here. After performing several operations on the selected file, the user can select another file and work on it.

2 - Display
This option displays the content of the selected file on the screen. If no file was selected an error message is displayed.

3 - Rename
The user is prompted for a new name for the selected file, then the file is renamed. If no file was selected an error message is displayed.

4 - To upper case
The file is read into memory, all of it in one buffer, all the characters are converted to UPPER CASE, then the file is overwritten. If no file was selected an error message is displayed.

5 - To lower case
The file is read into memory, all of it in one buffer, all the characters are converted to lower case, then the file is overwritten. If no file was selected an error message is displayed.

6 - Reverse each line
The file is read into memory, line after line. After each line read, the line is reversed and appended to the rest of the lines in one string buffer. In the end the file is overwritten with the content of the buffer. If no file was selected an error message is displayed.

7 - Reverse the whole file
The file is read into memory, all of it in one buffer, the buffer is reversed, then the file is overwritten. If no file was selected an error message is displayed. 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: The user is prompted for a file name
Reference No:- TGS0129572

Expected delivery within 24 Hours