File processing
Write a Java for file processing according to the following rules. The program requested for this project must have a text menu like this:
0 - Exit
1 - Select file
2 - Display
3 - Reverse
Select option:
The menu is displayed and the user must select an option (a number between 0 and 3). 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 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 - Reverse
The file is read into memory, all of it in one buffer, and the buffer is reversed, then the file is overwritten. For simplicity, we may assume that the maximum size of the file is 200000 bytes. If no file was selected an error message is displayed.