import javax.swing.*;
public class MethodsRevision18Oct {
public static int getInput3(String msg) {
int num;
String input = JOptionPane.showInputDialog(null, msg);
num = Integer.parseInt(input);
return num;
} //end getInput
public static int getInput2() {
int num;
String input = JOptionPane.showInputDialog(null, "Enter your age");
num = Integer.parseInt(input);
return num;
} //end getInput
public static void getInput() {
int num;
String input = JOptionPane.showInputDialog(null, "Enter a number");
num = Integer.parseInt(input);
JOptionPane.showMessageDialog(null, "You entered " + num);
} //end getInput
public static void main(String[] args) {
int age = getInput3("Enter your age");
JOptionPane.showMessageDialog(null,
"You are " + String.valueOf(age) +
" years old",
"Output", JOptionPane.INFORMATION_MESSAGE);
int salary = getInput3("Enter your salary");
JOptionPane.showMessageDialog(null,
"You earn $" + String.valueOf(salary),
"Output", JOptionPane.INFORMATION_MESSAGE);
} //end main
public static void sayHello() {
System.out.print("Hello");
}
} //end classs
Wednesday, October 18, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment