-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
30 lines (28 loc) · 1.01 KB
/
Copy pathMain.java
File metadata and controls
30 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
public class Main {
public static void main(String[] args) {
XMLParser parser = new XMLParser();
try {
List<Question> questions = parser.readInput();
Question.reorderQuestions(questions);
String prePrint = "==============Exam==============\n";
prePrint += Question.print(questions);
prePrint +="==========Exam answers==========\n";
prePrint += Question.printWithAnswers(questions);
output(prePrint);
}catch (NullPointerException | IOException e){
output("Wrong formatted input file");
}
}
public static void output(String text){
try {
FileWriter myWriter = new FileWriter("output.txt");
myWriter.write(text);
myWriter.close();
} catch (IOException e) {
System.out.println("Exception: Couldn't output!");
}
}
}