Assignment #41 and Using Swing for Input
Code
/// Name: Brendan Baird
/// Period: 6
/// Program Name: Using Swing for Input
/// File Name: Prog41.java
/// Date Finished: 10/6/2015
import javax.swing.*;
public class Prog41
{
public static void main (String[] args)
{
String name = JOptionPane.showInputDialog("What is your name?");
String input = JOptionPane.showInputDialog("How old are you?");
int age = Integer.parseInt(input);
System.out.print( "Hello, " + name + "." );
System.out.println( " Next year, you'll be " + (age+1) );
System.exit(0);
}
}
Picture of the output