public static String replaceVariables(HashMap<String,Double> elements, String line)
	{
		ArrayList<String> variables = scanForVariables(line);
		
		for(String s : variables)
		{
			if(elements.get(s) == null)
			{
				System.out.println("Variable \""+s+"\" was not found.");
				System.exit(3);
			}
			
			line = line.replace("$"+s,elements.get(s).toString());
		}
		
		return line;
	}