Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion java/src/main/java/ca/uwaterloo/cs489/exercise2/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ public int processJob() {
int rtn = input;

if (input == 0 || input == 1) {
file.delete();
return 1;
}

for (int i = input-1; i > 1; i--) {
rtn *= i;
}


file.delete();
return rtn;
}

Expand Down
4 changes: 3 additions & 1 deletion java/src/main/java/ca/uwaterloo/cs489/exercise2/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


public class MainApp {

private static Path getDirectory() throws IOException {
Expand All @@ -36,6 +36,8 @@ public static void main(String[] args) {
Job job = new Job(entry.toFile());
logger.info(String.format("Job %d yields %d\n", job.getInput(), job.processJob()));
}
File f = new File(dir.toString());
f.delete();
} catch (IOException e) {
e.printStackTrace();
}
Expand Down