Created
May 3, 2017 02:59
-
-
Save Jabriko/4290ba3063730b619c0087dbac0f2bab to your computer and use it in GitHub Desktop.
Questions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Questions { | |
public String mQuestions[] = { | |
"Which is the first planet in the Solar system?", | |
"Which is the second planet in the Solar system?", | |
"Which is the third planet in the Solar system?", | |
"Which is the fourth planet in the Solar system?", | |
"Which is the fifth planet in the Solar system?", | |
"Which is the sixth planet in the Solar system?", | |
"Which is the seventh planet in the Solar system?", | |
"Which is the eight planet in the Solar system?", | |
"Which is the ninth planet in the Solar system?" | |
}; | |
private String mChoices[][] = { | |
{"Mercury", "Venus", "Mars", "Saturn"}, | |
{"Jupiter", "Venus", "Earth", "Neptune"}, | |
{"Earth", "Jupiter", "Pluto", "Venus"}, | |
{"Jupiter", "Saturn", "Mars", "Earth"}, | |
{"Jupiter", "Pluto", "Mercury", "Earth"}, | |
{"Uranus", "Venus", "Mars", "Saturn"}, | |
{"Saturn", "Pluto", "Uranus", "Earth"}, | |
{"Venus", "Neptune", "Pluto", "Mars"}, | |
{"Mercury", "Venus", "Mars", "Pluto"} | |
}; | |
private String mCorrectAnswers [] = {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"}; | |
public String getQuestion(int a) { | |
String question = mQuestions [a]; | |
return question; | |
} | |
public String getChoice1 (int a) { | |
String choice = mChoices[a][0]; | |
return choice; | |
} | |
public String getChoice2 (int a) { | |
String choice = mChoices[a][1]; | |
return choice; | |
} | |
public String getChoice3 (int a) { | |
String choice = mChoices[a][2]; | |
return choice; | |
} | |
public String getChoice4 (int a) { | |
String choice = mChoices[a][3]; | |
return choice; | |
} | |
public String getCorrectAnswer (int a) { | |
String answer = mCorrectAnswers[a]; | |
return answer; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of having many methods you can have one with 2 params:
public String getChoice (int a, int b) {
return mChoices[a][b];
}