Basically, I have a code generator that I've made in java (that generates code for a Visual Basic Quiz program I'm making) that I would like to make more effecient by using it with a database.
If anyone is interested, this is what it looks like:
import java.io.*; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import java.util.Vector; public class codegen { static int qnum = 1; static int snum = 1; public static void main(String[] a) { Vector victor; int size = 10; victor = new Vector(size); for (int i = 0; i < size; i++) victor.addElement(new Integer(i)); try { PrintStream out = new PrintStream(new FileOutputStream( "OutFile.txt")); for (int i = 0; i < size; i++) while (snum <= 15){ if (qnum <= 71){ out.println("ElseIf Randq = " + qnum + " And sec" + snum + "(" + qnum + ") < 3 Then"); out.println("answrstrng = ''"); out.println("If usrinput = answrstrng Then"); out.println("Correct.Text += 1"); out.println("sec" + snum + "(" + qnum + ") += 1"); out.println("Else"); out.println("Incorrect.Text += 1"); out.println("sec" + snum + "(" + qnum + ") -= 1"); out.println("canswer.Text = answrstrng"); out.println("End If"); ++qnum; } else { qnum = 1; snum++; } } out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } }
It would make things a lot easier for me, and make the code generator complete, if where it saysi could replace the '' with text from the cell of an excel document. For example, if cell A1 said "Fiji" in the document, it would print answrstrng = "fiji".out.println("answrstrng = ''");
I don't really know anything about Java databases, so if there's another way I should do this outside of microsoft excel, information on that would help me too.
Thanks!