Hi,
I have almost finished a program to create and take quizes.
The quiz creator is finished but I have problem with the quiz taker.
The quiz file is a basic .csv file
To stop the student from reading the .csv file I am encrypting the file.
1. I am reading the csv file replacing \r\n with a a ¬, replacing \n with ~, and then replacing the ¬ with \r\n
2. I am then encrypting the file.
When the quiz runs I am decypting the file, replacing the ~ with \n and returning the data to csv format.
The questions and answers display correctly but I want to shuffle the questions
As soon as I add the collections.shuffle into the code I get this error
Exception in
thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at quiz.ReadEncryptedFile.ReadCSVFile(ReadEncryptedFile.java:110)
at quiz.UserInterface.main(UserInterface.java:194)
I think this is caused because the collections.shuffle has not completed.
I have tried to make the program pause but this just delays the error from appearing.
My csv file reader contains this code which is where the problem lies.