mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Abdelilah Khossan
42a8df96a9
|
1 year ago | |
---|---|---|
.. | ||
README.md | 1 year ago | |
input.txt | ||
result.txt |
README.md
Capitalize
Instructions
Create a file named Capitalize.java
.
Write a function capitalize
that reads the text from a file given as the first parameter and writes the result to a file given as the second parameter.
Provided files
You can find the input and its result files to use for the test and to understand more what you have to do.
Expected Functions
import java.io.*;
public class Capitalize {
public static void capitalize(String[] args) throws IOException {
// your code here
}
}
Usage
Here is a possible ExerciseRunner.java to test your function :
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
public class ExerciseRunner {
public static void main(String[] args) throws IOException {
Capitalize.capitalize(new String[]{"input", "output"});
String expectedResult = new String(Files.readAllBytes(Paths.get("result")));
String userOutput = new String(Files.readAllBytes(Paths.get("output")));
System.out.println(expectedResult.equals(userOutput));
}
}
and its output :
$ javac *.java -d build
$ java -cp build ExerciseRunner
true
$