Calculate 2 numbers of subtraction Gu Weihua 2015/10/6
Package Jisuan;
Import Javax.swing.JOptionPane;
public class Jiasuan {
public static void Main (string[] args) {
TODO auto-generated method stubs
String Firstnumber; Define the prompt word for the input box
String Secondnumber; Define the prompt word for the input box
Double NUM1; Define the first number of inputs
Double num2; Define the second number of inputs
Double add=0;
Double jian=0;
Double cheng=0;
Double chu=0;
Firstnumber =
Joptionpane.showinputdialog ("Please enter the first number");
Secondnumber =
Joptionpane.showinputdialog ("Please enter a second number");
NUM1 = Integer.parseint (Firstnumber);
num2 = Integer.parseint (Secondnumber);
add=num1+num2; Calculate A+b
if (NUM2>NUM1)//Compare the size of a and B
{
JIAN=NUM2-NUM1; Calculate b-a when B is greater than a
}
Else
{
jian=num1-num2; Calculates b-a when B is less than a
}
cheng=num1*num2; Calculate A*b
chu=num1/num2; Calculate A/b
Joptionpane.showmessagedialog (
NULL, "Two number of and is" + Add, "Results",
Joptionpane.plain_message); Output a+b
Joptionpane.showmessagedialog (
NULL, "The difference of two numbers is" + Jian, "Results",
Joptionpane.plain_message); Output A-B
Joptionpane.showmessagedialog (
NULL, "The product of two numbers is" + Cheng, "Results",
Joptionpane.plain_message); Output a*b
Joptionpane.showmessagedialog (
NULL, "Two-digit quotient is" + Chu, "Results",
Joptionpane.plain_message); Output A/b
System.exit (0);
}
}
Java after class job pop-up window for two number of subtraction