/*
Chapter 3:
Prog 1
Programmer:
Brad Shedd
Date:
April 26, 2006
Filename:
MyMath.java
Purpose:
This project calculates simple math
problems.
*/
import javax.swing.JOptionPane;
public
class
MyMath
{
public
static
void
main (String arg[] )
{
// declare
variables
String input1, input2;
int
value1, value2;
int
sum, difference, product;
double
quotient;
//get first
of two integers
input1 = JOptionPane.showInputDialog (null,
"Please enter first number: ");
value1 =
Integer.parseInt (input1);
input2 =
JOptionPane.showInputDialog(null,
"Please enter the second number");
value2 =
Integer.parseInt (input2);
JOptionPane.showMessageDialog (null,
input1,
"First Number",
JOptionPane.OK_CANCEL_OPTION );
JOptionPane.showMessageDialog (null,
input2,
"Second Number",
JOptionPane.OK_CANCEL_OPTION );
JOptionPane.showMessageDialog (null,
"Sum equals " + (value1 +
value2),
"Sum of the numbers", JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog (null,
"Difference equals " +
(value1 - value2),
"Difference of two Numbers",
JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog (null,
"Product equals " + (value1 *
value2),
"Integer Product", JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null,
"Quotient equals " + (value1 /
value2),
"Integer Division", JOptionPane.OK_CANCEL_OPTION);
System.exit(0);
}
}