Assignment #41: Using Swing for Input
Code
/// Name: Kiran O'Farrell
/// Period: 7
/// Program name: Using Swing for Input
/// File Name: UsingSwing.java
/// Date Finished: 11/17/15
import javax.swing.*;
public class UsingSwing {
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) + ".");
}
}
Pictures of the output