DialogBox - "Invoice",...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import javax.swing.JOptionPane; i public class DialogBox { public static void main(String[] args) { String name; String str; int num1 = 45; int num2 = 56; int sum; name = JOptionPane.showInputDialog("Enter your name and press OK"); JOptionPane.showMessageDialog(null, "Hello World!", "Greetings", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "Amount Due = $" + 500.45,
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: "Invoice", JOptionPane.PLAIN_MESSAGE); str = "The two numbers are: " + num1 + " and " + num2 + "\n"; sum = num1 + num2; str = str + "The sum of the numbers is: " + sum + "\n"; str = str + "That is all for now!"; JOptionPane.showMessageDialog(null, str, "Summing Numbers", JOptionPane.ERROR_MESSAGE); System.exit(0); } }...
View Full Document

Ask a homework question - tutors are online