l1: Intro to Java
You cannot submit for this problem because the homework's deadline is due.
Submission
You should submit a zip file containing the following package structure
Current directory
+-- com
| +-- ve472
| | +-- l1
| | | +-- Main.java
and the content of Main.java
should be the following,
package com.ve472.l1;
public class Main {
public static void main(String[] args) {
// write your code here
}
}
You should use org.apache.commons.cli
package to parse command line options. The package is provided by JOJ, so you don't need to include the package in your submission.
Compilation
Assuming you are at the directory containing com/ve472/l1
and you have org.apache.commons.cli
package jar file in the drive
r directory, you can try to compile your program with the following command
javac -d ./out -encoding utf8 -classpath ./com/ve472/l1/:./driver/commons-cli-1.4.jar ./com/ve472/l1/Main.java ./com/ve472/l1/Cinema.java ./com/ve472/l1/Hall.java
You can see that the class objects are generated in ./out
. Now you may run it with
cd out
java -classpath ../driver/commons-cli-1.4.jar: com.ve472.l1.Main
Sample Input and Output
Sample config file (hall)
apple.txt
apple
The Wandering Earth
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
bar.txt
bar
Faster Than Light: Kestrel Adventures
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
Sample input file (query)
Krystor He, The Wandering Earth, 3
Manuel, The Wandering Earth, 20
Jing, Faster Than Light: Kestrel Adventures, 12
Zhenhao, Faster Than Light: Kestrel Adventures, 5
Jinglei, The Wandering Earth, 6
Sample output
Krystor He,The Wandering Earth,apple,8,5,6,7
Manuel,The Wandering Earth
Jing,Faster Than Light: Kestrel Adventures,bar,8,1,2,3,4,5,6,7,8,9,10,11,12
Zhenhao,Faster Than Light: Kestrel Adventures,bar,7,4,5,6,7,8
Jinglei,The Wandering Earth,apple,7,4,5,6,7,8,9
Hidden Cases
There will be no hidden cases :-D Have fun!