/*
 * We will learn various methods for doing input. Some of you 
 * (in fact all of you) have used the Console class in CS1. 
 * Here we learn something a little different (and much more fun):
 * JOptionPane. JOptionPane has several methods we will need:
 * 
 * showInputDialog(String)- for input
 * showMessageDialog(null,String)- for output
 * showConfirmDialog(null,PromptString,WindowString,YES_NO_OPTION)- for Yes/No dialog
 * 
 * showInputDialog ALWAYS returns a String!! Thus, for numeric input,
 * the appropriate method must be called to CONVERT the String to
 * the appropriate value:
 *      Byte.parseByte(String)
 *      Short.parseShort(String)
 *      Integer.parseInt(String)
 *      Long.parseLong(String)
 *      Float.parseFloat(String)
 *      Double.parseDouble(String)
  
*/


import javax.swing.JOptionPane;   // IMPORTANT You need this line

public class UseStudentIOV2
{

   public static void main(String[] args)
   { String first,last,tempID;
     int ID;
     int i;
     Student s;
     int answer;
     
     while(true)
     {
         first=JOptionPane.showInputDialog("Enter first name ");
         last=JOptionPane.showInputDialog("Enter last name ");
         tempID=JOptionPane.showInputDialog("Enter ID ");
         ID=Integer.parseInt(tempID);
         s=new Student(first,last,ID);
         JOptionPane.showMessageDialog(null,s.toString());
         answer=JOptionPane.showConfirmDialog(null,
                                              "Do you want to continue",
                                              "Window Title",
                                              JOptionPane.YES_NO_OPTION);
         if(answer == JOptionPane.NO_OPTION) break;
     }
     System.exit(0);
                                              
         
  }
 
}