Posted: Sun Dec 09, 2007 6:01 pm Post subject: help make a quiz in Jcreator
I'm kind of new to programming, but I have to make a quiz in Jcreator for an assignment and I'm completely lost...
this is what it needs to do:
~ true and false quiz (I'm guessing this could be done using boolean)
~ use loops (for and while loops are both required)
~ use random generator to get 10 random questions (I have a list of around 75 questions for it to choose from)
~ use java.util.scanner to take user input to answer the questions
~ be able to exit the program at any time ("Q to quit")
~ prints score at the end
I went in to this thinking I knew what I would have to use to get it to work, so I thought, "Piece of cake!"
Then I realized I am an idiot and can't even get the random generator to work properly...
Please show me some examples of what I could do, I'm a girl in dire need of a passing grade X_X
Sponsor Sponsor
HeavenAgain
Posted: Sun Dec 09, 2007 6:26 pm Post subject: RE:help make a quiz in Jcreator
Quote:
can't even get the random generator to work properly...
code:
import java.util.Random;
class UniqueRandom
{
public static void main(String[] args)
{
Random random = new Random();
int[] questions = new int[10];
for (int i = 0; i < 10; i++)
questions[i] = random.nextInt(8)+i*8;
}
}
have you ever used random?
Saki
Posted: Sun Dec 09, 2007 6:29 pm Post subject: RE:help make a quiz in Jcreator
Yeah I have, to make a "lottery" program. But now I have to get it assign a random number to call a string, and I can't get it to work since I've never really done that before.
HeavenAgain
Posted: Sun Dec 09, 2007 6:33 pm Post subject: RE:help make a quiz in Jcreator
the code i put there, if it is corret, it is assigning random number from 0 - 80 unique to a 10 dimension array, altho is not the best, but it will work, hope that gives you some idea with your "generator"
Saki
Posted: Sun Dec 09, 2007 6:57 pm Post subject: Re: help make a quiz in Jcreator