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
31
32
33
34
35
36
37
38
39
40
41
42
package main;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import javax.swing.JOptionPane;

public class Main {

    public static void main(String[] args) {
    	File qAndA = new File("/Users/95jac04/eclipse_workspace/Pop_up_quiz/", "qAndA.txt");
    	//File qAndA = new File("/Users/95jac04/eclipse_workspace/Pop_up_quiz/qAndA.txt");
    	//File qAndA = new File("C:/Users/95jac04/eclipse_workspace/Pop_up_quiz/", "qAndA.txt");
    	//File qAndA = new File("C:\\Users\\Public\\Documents\\qAndA.txt");
    	//File qAndA = new File("qAndA.txt");
		System.out.println(qAndA.getCanonicalPath());
    	//String questionString = "Är glass gott?, Vad blir 1+2 ?, Stava till \"Bord\"., Skriv pi med 30 siffrors noggrannhet.";
    	FileReader fr = new FileReader(qAndA);
    	//FileReader fr = new FileReader("C:/Users/95jac04/eclipse_workspace/Pop_up_quiz/qAndA.txt");
    	BufferedReader fil= new BufferedReader(fr);
    	System.out.println(fil.readLine());
    	fr.close();
    	fil.close();
    	//System.out.println(fil.readline());
    	//String[] question = questionString.split(", ");
        String answerString = "Ja, 3, Bord, 3,14159265358979323846264338327950288419";
        String[] answer = answerString.split(", ");
        String inputAnswer;
        int correct = 0; //antal rätt
        /*for (int i = 0; i < question.length; i++) {
            inputAnswer = JOptionPane.showInputDialog(question[i]).toLowerCase(); //lowercase
            if (inputAnswer.equals(answer[i].toLowerCase())) { //lowercase
                correct++;
                JOptionPane.showMessageDialog(null, "Du svarade rätt!");
            } else {
                JOptionPane.showMessageDialog(null, "Fel svar! Rätt svar var: \"" + answer[i] + "\"");
            }
        }
        JOptionPane.showMessageDialog(null, "Frågorna är slut och du fick " + correct + " av " + question.length + " möjliga poäng.");
    */
    }
}