Assignemnt #41 Using Swing for Input
Code
/// Name: Jake Johnson
/// Period: 7
/// Program Name: using swing for imput
/// File Name: usingswingforimput.java
/// Date Finished: 10/8/2015
import javax.swing.*;
public class usingswingforimput
{
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