Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Scanner doesn't work in Processing
    primarykey
    data
    text
    <p>For an assignment I have due, my group and I were asked to code an educational/interactive game, and we decided on a basic maths one. </p> <p>To get the users answers, we decided to use Java Scanner and put this line of code at the top of all the code we have;</p> <p><code>java.util.Scanner</code></p> <p>One of the loops that use this is the page with the questions on it, the loop looking something like this;</p> <pre><code>scoreCount = 0; for (questions = 0; questions &lt; 5;) { //get the user's answer userAnswer[questions] = input.nextInt(); //text box for users answer if (userAnswer[questions] == compAnswer) { //put tick next to answer //add one to score scoreCount = scoreCount + 1; } else if (userAnswer[questions] != compAnswer) { //put cross next to answer } //go to next question questions++ ; } </code></pre> <p>I'm working through all the errors that were thrown up and every time i don't have <code>java.util.Scanner</code> commented out Processing throws us the errors <code>unexpected token:</code> and then either <code>class</code> or <code>void</code>, which i don't get, but when <code>java.util.Scanner</code> is commented out, the classes and voids all work and the <code>.input.nextInt()</code> isn't recognised.</p> <p>I am new to Java programming and Processing, any help at all would be greatly appreciated</p> <p><strong>EDIT</strong></p> <p>i think this is the link which lets you see my code, it's called Test;</p> <p><a href="https://github.com/MeganSime/Week8DataVis" rel="nofollow">https://github.com/MeganSime/Week8DataVis</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload