public static void generateQuiz(Scanner keyboard, Problem problem)
	{
		boolean toRandomize, addLetters; 
		int nVersions;
		String label, fileName;
		QuestionSet questions;
		QuizConfiguration qc;
		
		qc = getQuizConfiguration(keyboard);
		
		questions = problem.getQuestions();
		toRandomize = qc.isToRandomize();
		nVersions = qc.getnVersions();
		label = qc.getLabel();
		fileName = qc.getFileName();
		addLetters = qc.getAddLetters();
		
		File file;
		PrintWriter pw = null;
		
		char c;
		String header;
		
		try
		{
			file = new File(System.getProperty("user.dir")+"\\Quiz Generator\\Quizzes\\"+fileName);
			pw = new PrintWriter(file);
			
			for(int n=0;n<nVersions;n++)
			{
				c = (char)(65 + n);
				header = "=="+label+" Version "+c+"==";
				
				pw.println(header);
				pw.println("<quiz display=simple>");
				
				//calculates all new elements
				problem.calculate(addLetters);
				
				pw.println(problem.getProblemHeader());
				pw.println();
				
				if(n!=0 && toRandomize)
				{
					questions.randomizeQuestions();
				}
				
				for(Question q : questions)
				{
					q.printToFile(pw,addLetters);
				}
				
				pw.println("</quiz>");
			}
			
			pw.close();
		}
		catch(FileNotFoundException e)
		{
			System.out.println("Quiz Generator Error 1");
			System.exit(4);
		}
	}