From 6c55bb0e78fb94b17fe77344448061b37dbeb864 Mon Sep 17 00:00:00 2001 From: Ozan-Can Ekinci Date: Sun, 15 Jan 2023 20:31:06 +0100 Subject: [PATCH] created file and String array for showing question value --- QandA/Money.txt | 15 +++++++++++++++ src/main/java/Gui/GameGui.java | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 QandA/Money.txt diff --git a/QandA/Money.txt b/QandA/Money.txt new file mode 100644 index 0000000..12b1b66 --- /dev/null +++ b/QandA/Money.txt @@ -0,0 +1,15 @@ +50 +100 +200 +300 +500 +1.000 +2.000 +4.000 +8.000 +16.000 +32.000 +64.000 +125.000 +500.000 +1.000.000 \ No newline at end of file diff --git a/src/main/java/Gui/GameGui.java b/src/main/java/Gui/GameGui.java index dec7129..997a964 100644 --- a/src/main/java/Gui/GameGui.java +++ b/src/main/java/Gui/GameGui.java @@ -11,6 +11,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import game.loadNextQuestion; +import game.runGame; public class GameGui implements GameGuiInterface { @@ -107,8 +108,9 @@ GridBagConstraints gbc; @Override public void createShowQuestion(int i) { - int money[] = {10,20,30,40,50,60,70,80,90,100,110,120,130,140,150}; - String questionText = "Frage " + counter + ": " + money[i - 1] + "€"; + int numLines = runGame.CountFileLines("QandA/Money.txt"); + String[] arrMoney = runGame.readFile("QandA/Money.txt", numLines); + String questionText = "Frage " + counter + ": " + arrMoney[i - 1] + "€"; counter++; ShowQuestionNr.setText(questionText);