From 407beaffc93aaa2dc30b40e1b9b858a453d6f464 Mon Sep 17 00:00:00 2001 From: Leon Montag Date: Fri, 30 Dec 2022 12:03:22 +0100 Subject: [PATCH] implemented the line counting method --- src/main/java/game/runGame.java | 11 +++++++---- target/MiniGameProject-1.0-SNAPSHOT.jar | Bin 5898 -> 5941 bytes target/maven-archiver/pom.properties | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/game/runGame.java b/src/main/java/game/runGame.java index 3f0fb1e..954dfc8 100644 --- a/src/main/java/game/runGame.java +++ b/src/main/java/game/runGame.java @@ -7,25 +7,28 @@ import java.io.IOException; public class runGame { public static String QuestionsPath = "QandA/Questions.txt"; public static String AnswersPath = "QandA/Answers.txt"; + public static int lines; public void run() { CountFileLines(QuestionsPath); readFile(QuestionsPath); } - public long CountFileLines(String Path) { + public int CountFileLines(String Path) { try { BufferedReader reader = new BufferedReader(new FileReader(Path)); - + while (reader.readLine() != null) { + lines++; + } } catch (IOException e) { e.printStackTrace(); } - return 0; + return lines; } public static String[] readFile(String Path) { BufferedReader reader; - String[] Arr = new String[6]; + String[] Arr = new String[lines]; try { reader = new BufferedReader(new FileReader(Path)); String line = reader.readLine(); diff --git a/target/MiniGameProject-1.0-SNAPSHOT.jar b/target/MiniGameProject-1.0-SNAPSHOT.jar index 8791b16cdc826e81a2e602ef1e9c8d9324e5956b..279db4fbc6d801c15bc10ce161c5bdf9759f6e53 100644 GIT binary patch delta 1370 zcmeCu+p5PC;LXg!#Q*{!2@`o#nSv808qWfe=N0vX6Xu12rJw{0kajQ4)Q9QeU;wGG z+iGW2!py+%bFw_6bp7cdVMh_$Ts0q|HUS}~6+f6v`9FQ=7W>!p^xCE)mu;P|FqvPzyZyaw?YW(IKYzV`T%Y0G0;$7# zEhQOjhh7MH*ci^A{dCt$o$2{{b{n(iIUL{d_Qt&y2aVa$9ZF3r`eroN`$;ez+w}8{ z)^6SOS&JR6znymV%bT{#ds3_VStnh!FZet!+xm2}A=44w5@kh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