| // simple
program to input 2 numbers, print largest, and total
import java.io.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Application1
{
public Application1()
{
int total=0;
int num1;
int num2;
String number;
number = JOptionPane.showInputDialog("enter a number
"); // get first number
num1 = Integer.parseInt(number);
// convert to integer
total=total+num1;
number = JOptionPane.showInputDialog("enter a
number "); // get second number
num2 = Integer.parseInt(number);
// convert to integer
total=total+num2;
i f (num1 > num2)
{
JOptionPane.showMessageDialog(null,"big number is "+num1);
}
else
{
JOptionPane.showMessageDialog(null,"big number is "+num2);
}
JOptionPane.showMessageDialog(null,"total
is "+total);
}
public static void main(String args[])
{
Application1 app = new
Application1();
System.exit(0);
}
}
|