public int checkAnswers(int week, User user, ArrayList<Integer> userAnswers) {
		int score = 0;
		PreparedStatement answerStatement = null;
		PreparedStatement questionStatement = null;
        Connection connection = null;
        try {
            try {
            	connection = data.getConnection();
                answerStatement = connection.prepareStatement("SELECT questionID FROM Answer WHERE answerID = ?");
                questionStatement = connection.prepareStatement("SELECT answerID FROM Question WHERE questionID = ?");
                for(Integer answer: userAnswers) {
                	answerStatement.setInt(1, answer);
                	ResultSet answerSet = answerStatement.executeQuery();
                	answerSet.next();
                	int questionID = answerSet.getInt("questionID");
                	questionStatement.setInt(1, questionID);
                	ResultSet correctAnswer = questionStatement.executeQuery();
                	correctAnswer.next();
                	int correctAnswerID = correctAnswer.getInt("answerID");
                	if(answer == correctAnswerID) {
                		score++;
                	}
                }
                insertScore(week, user, score);
                return score;
            }
            finally {
            	if(answerStatement != null) {
            		answerStatement.close();
            	}
            	if(questionStatement != null) {
            		questionStatement.close();
            	}
            	if(connection != null) {
            		connection.close();
            	}
            }
        }
        catch (SQLException ex) {
        	System.out.println("Error checking the answers");
        	ex.printStackTrace();
        	return -1;
        }
	}