Assignemnt #41: Using Swing for Input

Code

    /// Name: Cassie
    /// Period: 6
    /// Program Name: Using Swing for Input
    /// File Name: SwingInput.java
    /// Date Finished: 11/13/2015
    
    import javax.swing .*;
        
    class SwingInput 
    {
        
        public static void main ( String[] args) 
        {
            
            String name = JOptionPane.showInputDialog( "What is your name?" );
            
            String input = JOptionPane.showInputDialog( "How old are you, " + name + "?" );
            
            int age = Integer.parseInt(input);
            System.out.print( "Hello, " + name + "." );
            System.out.println ( " Next year, you will be " + (age+1) + "." );
                
            System.exit(0);
         }
      }
    

Picture of the output

Assignment 41