/** This program is intended to be used with the book "Java 6 -- What Do You Want To Do?"
 * by Steven P. Warr and is distributed free of charge and without and expectations of remuneration.
 * Chapter BAS   NOTE all programs begin with the  title of the chapter in which
 * they are intended to be used.   Copyright 2008 Steven P. Warr All rights reserved
 */


import javax.swing.JOptionPane; 

public class Bas06 
{
    public static void main(String[ ] args) 
    {
       //variable definition statements.
              String inValue = "";		//empty String for input ;
              String name = "";    
	          int firstNum = 0, secondNum = 0;   	//initialize to 0
              int sum = 0, difference = 0, product = 0; 
              double quotient = 0;  		// The quotient will need decimals.
      		
       //input statements
              inValue = JOptionPane.showInputDialog( "Enter your Name  " );  //Prompt
                                 		//AND input  as String into inValue.  Two for one.
              name = inValue;      	//copies inValue into name.
              inValue = JOptionPane.showInputDialog( "Enter a number " );  //Prompt
                    firstNum = Integer.parseInt(inValue);   //parseInt converts String inValue to int firstNum.
              inValue = JOptionPane.showInputDialog( "Enter another number " );  
                    secondNum = Integer.parseInt(inValue);   
	
	//calculation statements are the same.
	          sum = firstNum + secondNum;            
	          difference = firstNum - secondNum;   
	          product = firstNum * secondNum;
	          quotient = (double)firstNum / secondNum;   

	//output statements.  
    		  JOptionPane.showMessageDialog(null, "Hello " + name + ".\n" +
                     " The sum of  " + firstNum + " and   " + secondNum + " is  " + sum 
                     + ".\n" +
					 "The difference of  " + firstNum + " and " + secondNum + " is  " + difference 
					+ ".\n" +    
					 "The product of  " + firstNum + " and " + secondNum + " is  " + product  
					+ ".\n" +      
					 "The quotient of  "+ firstNum + " and " + secondNum + " is  " + quotient);  
//There is only one output statement.  The ".\n" is a control or escape code that signals the
//compiler to go to the next line before printing the next string.
    }
}    

