Friday, August 16, 2013

Exercise no. 18

import javax.swing.JOptionPane;


public class Exercise18 {
  
    public static void main(String []args)
    {
     
        int score=0;
        int score1=0;
     
  
        for(int x=1;x<=9;x++)
           
        {
            score=Integer.parseInt(JOptionPane.showInputDialog(null, "Team  A " + "\n" + "Enter Runs Score " + " inning [" + x + "]"));
            score=score+score;
        }
     
        for(int y=1;y<=9;y++)
           
        {
            score1=Integer.parseInt(JOptionPane.showInputDialog(null, "Team  B " + "\n" +" Enter Runs Score "+ " inning [" + y + "]"));
            score1=score1+score1;
        }
     
        JOptionPane.showMessageDialog(null, "Total Score of Team  A : " + score + "\n" + "Total Score of Team  B :" + score1);
     
    }
  

}

No comments:

Post a Comment