init
This commit is contained in:
1
jokeprovider/.gitignore
vendored
Normal file
1
jokeprovider/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
8
jokeprovider/build.gradle
Normal file
8
jokeprovider/build.gradle
Normal file
@@ -0,0 +1,8 @@
|
||||
apply plugin: 'java'
|
||||
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.headlezz.jokeprovider;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Provder class for jokes
|
||||
*/
|
||||
public class JokeProvider {
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
/**
|
||||
* jokes taken from http://www.devtopics.com/best-programming-jokes/
|
||||
*/
|
||||
String[] jokes = new String[] {
|
||||
"Two bytes meet. The first byte asks, “Are you ill?”\nThe second byte replies, “No, just feeling a bit off.”",
|
||||
"Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”\n\n“Yeah,” reply the bytes. “Make us a double.”",
|
||||
"Q. How did the programmer die in the shower?\nA. He read the shampoo bottle instructions: Lather. Rinse. Repeat.",
|
||||
"How many programmers does it take to change a light bulb?\nNone – It’s a hardware problem",
|
||||
"Why do programmers always mix up Halloween and Christmas?\nBecause Oct 31 equals Dec 25.",
|
||||
"There are only 10 kinds of people in this world: those who know binary and those who don’t.",
|
||||
"A programmer walks to the butcher shop and buys a kilo of meat. An hour later he comes back upset that the butcher shortchanged him by 24 grams.",
|
||||
"Programming is 10% science, 20% ingenuity, and 70% getting the ingenuity to work with the science.",
|
||||
"Programming is like sex: One mistake and you have to support it for the rest of your life.",
|
||||
"All programmers are playwrights, and all computers are lousy actors."
|
||||
};
|
||||
|
||||
public String getRandomJoke() {
|
||||
int randomIndex = random.nextInt(jokes.length);
|
||||
return jokes[randomIndex];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user