import javax.swing.JOptionPane; 


class Game {
    public static void main(String[] args)
    {
        String  
 //answers to be input
        inputA, inputB, inputC, inputD, inputE; 
        int
        //counting values for the five questions
        run1 = 0, run2 = 0, run3 = 0, run4 = 0, run5 = 0,
        //point values
        point1, point2, point3, point4, point5, pointTotal;
        String
        AnswerA = "Wayne Gretzky", AnswerB = "Kirk McLean", AnswerC = "2", AnswerD = "Jacques Demers", AnswerE = "1917";
        
        
         JOptionPane.showMessageDialog(
           null, "Have fun playing the hockey trivia game!" + "\n" + 
           "Answers are either spelt with capitols or numbers", "Good Luck!",
           JOptionPane.PLAIN_MESSAGE);
           
           while (run1 < 3)
           {
            run1 += 1;
      inputA = JOptionPane.showInputDialog("Who has the highest point total in NHL history?");
        if (inputA.equals(AnswerA))
    {
 run1 = 10;
  JOptionPane.showMessageDialog(
           null, "Correct!", "Note:",
           JOptionPane.PLAIN_MESSAGE);
 }
        else {
        JOptionPane.showMessageDialog(
           null, "You have answered incorrectly", "Note:",
           JOptionPane.PLAIN_MESSAGE);
        }   
         
           
           }
        
        
         while (run2 < 3)
           {
            run2 += 1;
      inputB = JOptionPane.showInputDialog("Which goalie has played the most (timewise) in 1 playoff Season?");
        if (inputB.equals(AnswerB))
    {
 run2 = 10;
  JOptionPane.showMessageDialog(
           null, "Correct!", "Note:",
           JOptionPane.PLAIN_MESSAGE);
 }
        else {
        JOptionPane.showMessageDialog(
           null, "You have answered incorrectly", "Note:",
           JOptionPane.PLAIN_MESSAGE);
        }   
        
           
           }
           
           while (run3 < 3)
             {
             run3 += 1;
      inputC = JOptionPane.showInputDialog("How many overtime games in NHL playoff history have gone into a sixth overtime period?");
        if (inputC.equals(AnswerC))
    {
 run3 = 10;
  JOptionPane.showMessageDialog(
           null, "Correct!", "Note:",
           JOptionPane.PLAIN_MESSAGE);
 }
        else {
        JOptionPane.showMessageDialog(
           null, "You have answered incorrectly", "Note:",
           JOptionPane.PLAIN_MESSAGE);
        }   
        
           
           }
            while (run4 < 3)
            {
             run4 += 1;
      inputD = JOptionPane.showInputDialog("Who is the only coach to win the Jack Adams Award in back to back years?");
        if (inputD.equals(AnswerD))
    {
 run4 = 10;
  JOptionPane.showMessageDialog(
           null, "Correct!", "Note:",
           JOptionPane.PLAIN_MESSAGE);
 }
        else {
        JOptionPane.showMessageDialog(
           null, "You have answered incorrectly", "Note:",
           JOptionPane.PLAIN_MESSAGE);
        }   
         
           
           }
            while (run5 < 3)
           {
           run5 += 1;
      inputE = JOptionPane.showInputDialog("What was the first year an American team won the Stanley Cup?");
        if (inputE.equals(AnswerE))
    {
 run5 = 10;
  JOptionPane.showMessageDialog(
           null, "Correct!", "Note:",
           JOptionPane.PLAIN_MESSAGE);
 }
        else {
        JOptionPane.showMessageDialog(
           null, "You have answered incorrectly", "Note:",
           JOptionPane.PLAIN_MESSAGE);
        }   
         
           
           }
           if(run1 == 10) {
           point1 = 1;  }
           else {
           point1 = 0; }
            
            if(run2 == 10) {
           point2 = 1;  }
           else {
           point2 = 0; }
             
             if(run3 == 10) {
           point3 = 1;  }
           else {
           point3 = 0; }
           
             if(run4 == 10) {
           point4 = 1;  }
           else {
           point4 = 0; }
           
             if(run5 == 10) {
           point5 = 1;  }
           else {
           point5 = 0; }
           
           pointTotal = point1 + point2 + point3 + point4 + point5;
            JOptionPane.showMessageDialog(
           null, "You have scored " + pointTotal + " point(s)", "Your Score:",
           JOptionPane.PLAIN_MESSAGE);
           
        }
        }
Hosted by www.Geocities.ws

1