View Single Post
  #2 (permalink)  
Old 01-19-2008, 11:16 PM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,266
hardwired is on a distinguished road
Code:
private void askQuestions(String[] questions, String[] answers) { int count = 0; int point = 0; for(int j = 0; j < questions.length; j++) { if(!timeForMore) break; String input = JOptionPane.showInputDialog(null, questions[j]); if(answers[j].equals(input)) { count++; point++; } } JOptionPane.showMessageDialog(null, "You answered " + count + " out of " + questions.length + " questions correctly."); JOptionPane.showMessageDialog(null, "Your Geography Quiz score is " + ((point*100)/10) + " % "); if(point>=0 && point<=3) { JOptionPane.showMessageDialog(null, "You need to Improve"); } if(point>=4 && point<=7) { JOptionPane.showMessageDialog(null, "Good"); } if(point>=8 && point<=10) { JOptionPane.showMessageDialog(null, "You did Great"); } }
Reply With Quote