I'm currently working on an assignment and I am having a lot of trouble with figuring out how to work this. I don't know how to read the files from the command prompt like this question is asking for. Here is the question, if you can give me any suggestions or snippets of source code it would be very helpful. Or even just point me in the right direction. Thanks.
"" said:
Develop an application in Java called myCat.java for displaying/concatenating text files. When you run this application with a command line parameter(s) specifying the name(s) of a file(s)
java myCat file_name
java myCat file_name1 file_name2
it should print to the terminal the contents of the text file(s) file_name in a way similar to invoking the Unix utility
cat file_name
If the user does not specify any file name or asks for a non exiting file, your myCat application should display a descriptive message reminding the user to fix the command line parameter, and then myCat should close (Hint: try this with cat)
Test your program on the source code of your solution to this assignment itself, i.e. on the file myCat.java, and then on three other files at the same.
(Hint: Read the description of the cat utility http://en.wikipedia.org/wiki/Cat_(Unix) . On a Linux workstation view the manual page for the cat utility (type man cat in the terminal window.)
Submit (to the assignment bin, printed copy) the source code and the output with the response to java myCat file1 file2 file3 for the case
(i) when all three files exist, and for the case when
(ii)one of them does not exist.
java myCat file_name
java myCat file_name1 file_name2
it should print to the terminal the contents of the text file(s) file_name in a way similar to invoking the Unix utility
cat file_name
If the user does not specify any file name or asks for a non exiting file, your myCat application should display a descriptive message reminding the user to fix the command line parameter, and then myCat should close (Hint: try this with cat)
Test your program on the source code of your solution to this assignment itself, i.e. on the file myCat.java, and then on three other files at the same.
(Hint: Read the description of the cat utility http://en.wikipedia.org/wiki/Cat_(Unix) . On a Linux workstation view the manual page for the cat utility (type man cat in the terminal window.)
Submit (to the assignment bin, printed copy) the source code and the output with the response to java myCat file1 file2 file3 for the case
(i) when all three files exist, and for the case when
(ii)one of them does not exist.


Sign In
Create Account


Back to top









