Long time admirer, first time poster :)
Hi all, I suspect that the question needs further explanation as this may potentially be a catastrophic design flaw in my first attempt at a Java quiz.
The game is this... user is asked a maths question, then given a choice of 3 and must input 1, 2 or 3 as their answer...this is then to be compared to the ACTUAL answer and then the users' score is incremented/decremented by one.
So far, I have everything in place that will generate the random bits to construct the question along with fake answers and the correct sum.
I am up to the point where the user chooses 1,2 or 3...I have the if statement and everything.
So now the context has been set, this is fundamental the problem...
User sees on the screen...
"What is... 32-83 (1): -51 (2): -55 (3): -48
Please enter your selection:"
If the user presses say 2 which is the incorrect answer, how do I capture the '-55' bit, if I could do that I suspect I could do a compare on the return which provides me with the right answer (a simple bool compare perhaps).
This is my first attempt at putting Java to use :)
Thanks in advance!
Ah, probably worth mentioning that this is the code that generates the question to be shown on screen...
public String generateQuestionOnScreen(){
String s = "What is... "+l+""+c+""+r;
return s;
}
..and this shows the options..
public void generateOptionsOnScreen(){
int array[]=new int[3];
array[0]=result;
array[1]=fake1;
array[2]=fake2;
System.out.println("(1): "+result);
System.out.println("(2): "+fake1);
System.out.println("(3): "+fake2);
}