All pastes #249469 Raw Edit

Untitled

public text v1 · immutable
#249469 ·published 2006-11-15 20:30 UTC
rendered paste body


 import javax.swing.*; // import the swing library for I/O


/* class Football
{    
    public static void main (String[] param)
    {
        ask();
        game();
        tables();
        System.exit(0);
    } 
*/
    
class Football

{   
    public static void main (String[] param)
     { 
       /* //Variables
        String Option;
        
        Option = JOptionPane.showInputDialog("What do you want to do? \nSelection 1: Input Scores \n Selection 2: See results");

        if (Option.equals("1"))
        game();
        else if (Option.equals("2"))
        tables();
       
    } */
      
        String Winner = game();
         tables(Winner);
         System.exit(0);
         
     } // END main
 
      public static String game()
    {
     //declare variables
      String[] Teams = {"Man U","Spurs","Chelsea","West Ham","Gunners"}; 
      int NoOfTeams = 6; 
      //String League;   
      String TeamA;
      String TeamB;  
      String ScoreTeamA;
      String ScoreTeamB;
      int ScoreA;
      int ScoreB;   
      String Winner;
      

            /*  {//get info about the league, etc
               League = JOptionPane.showInputDialog("What League is this?");

                Howmany = JOptionPane.showInputDialog("How many Teams are playing?"); 
                NoOfTeams = Integer.parseInt(Howmany); 
               }//End get info */

   
              {//Start main part 
                TeamA = JOptionPane.showInputDialog("What is the name of the 1st Team that is playing " +
                                                                    "today? ");
                TeamB = JOptionPane.showInputDialog("What is the name of the 2nd team playing " +
                                                                "today?");
                                                                
                ScoreTeamA = JOptionPane.showInputDialog("How many goals did" + " " + TeamA + " " + "score?");
                ScoreA = Integer.parseInt(ScoreTeamA); 
      
                ScoreTeamB = JOptionPane.showInputDialog("How many goals did" + " " + TeamB + " " + "score?");
                ScoreB = Integer.parseInt(ScoreTeamB); 
            }//End main part 
            
              
            { //Find the winner
               if (ScoreA > ScoreB)
               Winner = TeamA;
               else 
               Winner = TeamB;
            }//End find the winner
            
              JOptionPane.showMessageDialog(null, "The winner is" + " " + Winner + "!!"); //declare winner 
              return Winner;

     } // END Game
     
     public static void tables(String Winner)
     {
               JOptionPane.showMessageDialog(null, "The winner is" + " " + Winner + "!!"); //declare winner 
     }
     
} // END class football