sorry my tittle is a little broad. but im taking computers in grade 12 and my assignment is to make a little program that generates numbers and if it is equal to another set of numbers, you win, kind of like a lottery. i found it difficult to make the random number generator work twice so i pre loaded one of the number variables. now my last task is to get it to say "you win" if one of the numbers match, and if not "you loose", basically i just cant match the variables?`
Random rn = new Random();
String answer = " 3\n 12 \n 27";
for(int i =0; i < 3; i++)
{
int answer1 = rn.nextInt(30) + 1;
delay(2000);
System.out.println(answer1);
}
System.out.println("And the winning numbers are...");
delay(2000);
System.out.println(answer); }
`
Aucun commentaire:
Enregistrer un commentaire