/* Author: Arsalan Modjbafan
* Due date: 08-25-04
* Lab #: Lab 2A
* File: Birthday.Java
*
* The Lab2A class will bring up an input box that asks for a users birth date
* Then uses that information to show them a message spliting up the Month Day and Year
*/
import javax.swing.*;
public class Birthday {
public static void main( String[] args) {
JFrame lab2A;
lab2A = new JFrame();
lab2A.setSize(700,400);
lab2A.setLocation(324,0);
lab2A.setTitle("Lab 2A");
lab2A.setVisible(true);
String month, day, year, birthday;
birthday = JOptionPane.showInputDialog(lab2A,
"Enter birth date in the format Month Day, Year\nFor example: August 25, 2004");
month = birthday.substring(0, birthday.indexOf(" "));
day = birthday.substring(birthday.indexOf(" ") + 1);
year = birthday.substring(birthday.indexOf(", ") + 1);
JOptionPane.showMessageDialog(lab2A, "Month: " + month + "\nDay: " + day + "\nYear: " + year);
}
}
Bookmarks