Description
Applied Arts & Technology
20 20
Workshop#5
Notes:
i. One Task should be demoed in Feb14 lab. ii. Make sure you have all security and check measures in place, like wrong data types etc., no need to implement Exception as we haven’t covered yet (If you know it you are allowed to use). There are other ways to handle bad input data.
iii. Given output structure is just for student to have a glimpse what the output can look, students are free to make the output better in any way.
Other inputs can be given during demo, so make sure you test your program properly.
Task 1: Write a program that removes all the occurrences of a specified string from a text file.
For example, invoking java Q1 John filename removes the string John from the specified file. Your program should get the arguments from the command line.
Task 2: Write a program that converts the Java source code from the next-line brace style to the end-of-line brace style. For example, the following Java source in (a) uses the next-line brace style. Your program converts it to the end-of-line brace style in (b).
Your program can be invoked from the command line with the Java sourcecode file as the argument. It converts the Java source code to a new format. For example, the following command converts the Java source-code file Test.java to the end-of-line brace style.
java Task2 Test.java
Task 3: Write a program that will count the number of characters, words, and lines in a file. Words are separated by whitespace characters. The file name should be passed as a command-line argument, as shown below. java Q3 filename
Reviews
There are no reviews yet.