Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    15
    Views
    1,601

    Re: Default constructor generating random questions

    create a random number in range 0-n
    the use if/else if statements to test it: ==0 or ==1 or ==2 ... or ==n
  2. Replies
    15
    Views
    1,601

    Re: Default constructor generating random questions

    Can you use if/else if or switch statements? Generate an int in the range 0-n and use one of those statement to select the statements to execute.
  3. Replies
    15
    Views
    1,601

    Re: Default constructor generating random questions

    If the questions were in an array, get a random index to get the question from the array.
  4. Replies
    15
    Views
    1,601

    Re: Default constructor generating random questions

    What values are the instance variables given before their values are replaced with 6 and 0?

    A problem I see is this compound expression: ((int)(Math.random())*12+6);
    Needs to be separated into...
  5. Replies
    15
    Views
    1,601

    Re: Default constructor generating random questions

    The posted code does not compile without errors. You need to fix the compiler errors in the posted code. I can not execute the code because of the errors.

    If you are having problems fixing the...
  6. Replies
    15
    Views
    1,601

    Re: Default constructor generating random questions

    Try Add some println() statements to print the values of all the variables used to compute the values so you can see what the statements are doing.


    Use the Random class or the random method of...
  7. Replies
    15
    Views
    1,601

    Re: Default constructor generating random questions

    Find where the toString() method gets the values it returns in the String.
    Then look at where the variables used in the toString() method are given values.
    Then look at the code that puts values in...
  8. Replies
    15
    Views
    1,601

    Re: Default constructor generating random questions

    How are you trying to debug the code to find the problem? Try adding some println() statements that print the values of variables as they are set and used.
Results 1 to 8 of 8