Make a random joke generator.
Use an array inside of the joke object for your jokes.
Code:
String jokes[] = {"Why did the chicken cross the road","joke 2","etc"};
String answers[] = {"To get to the other side","joke 2 answer", "etc"};
keep the arrays parrallel to make it easier.
use a while loop to go through the array a random number of times and pick a joke kinda weird but neat.
Code:
while (jokeNum != randomNumberGenerated)
{
int Count++;
}
get and return the specified joke to the main class using intCount
Code:
jokes[intCount];
answers[intCount];
maybe keep track of the intCount used before and use an if else to make sure it doesnt send the same joke twice in a row.
Code:
if (oldIntCount == newIntCount)
generateNewNumber();
just an idea (:
Ty
Bookmarks