Skip to content

Instantly share code, notes, and snippets.

Created August 2, 2016 02:06
Show Gist options
  • Save anonymous/d09bfd8665cbbf5d7133d731ab788e02 to your computer and use it in GitHub Desktop.
Save anonymous/d09bfd8665cbbf5d7133d731ab788e02 to your computer and use it in GitHub Desktop.
public void takeQuiz() {
for( Question qtn : questions) {
QtnOutcome outcome = qtn.displayQuestion();
do{if(outcome == QtnOutcome.CORRECT){
AudioClip right = new AudioClip("file:///C://Users/coolm/Documents/NetBeansProjects/Question/Music/jawsofdeath.wav");
right.play(1.0);
GUIHelper.show("CORRECT");
score += 5;
break;
} else if(!(questions.equals("1") || questions.equals("2") || questions.equals("3") || questions.equals("4"))){
AudioClip leavenoblanks = new AudioClip("file:///C://Users/coolm/Documents/NetBeansProjects/Question/Music/forget.wav");
leavenoblanks.play(1.0);
GUIHelper.show("Pls, no blanks and do not put in any other word or number besides 1 to 4! I'm watching you");
outcome = QtnOutcome displayQuestion();
} else if(outcome == QtnOutcome.WRONG){
AudioClip mistake = new AudioClip("file:///C://Users/coolm/Documents/NetBeansProjects/Question/Music/fail.wav");
mistake.play(1.0);
GUIHelper.show("Unfortunately, you are wrong " +qtn.ans+ ".");
score -= 5;
break;
}
}while(!(questions.equals("1") || questions.equals("2") || questions.equals("3") || questions.equals("4")) || (outcome == QtnOutcome.WRONG));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment