October 1st, 1999, 11:19 AM
I can't figure out what to put in here where the ?'s are to get it to read Odd and Even numbers...
import javax.swing.JOptionPane;
public class Even {
public static void main (String args[])
{
String num1;
int n1,odd,even;
num1 = JOptionPane.showInputDialog("Please type in an integer:");
n1 = Integer.parseInt(num1);
odd = ? ;
even = ? ;
if( ? )JOptionPane.showMessageDialog(
null,"The number is "+odd,"Results",JOptionPane.INFORMATION_MESSAGE);
else JOptionPane.showMessageDialog(
null,"The number is "+even,"Results",JOptionPane.INFORMATION_MESSAGE);
System.exit (0);
}
}
Please help!
import javax.swing.JOptionPane;
public class Even {
public static void main (String args[])
{
String num1;
int n1,odd,even;
num1 = JOptionPane.showInputDialog("Please type in an integer:");
n1 = Integer.parseInt(num1);
odd = ? ;
even = ? ;
if( ? )JOptionPane.showMessageDialog(
null,"The number is "+odd,"Results",JOptionPane.INFORMATION_MESSAGE);
else JOptionPane.showMessageDialog(
null,"The number is "+even,"Results",JOptionPane.INFORMATION_MESSAGE);
System.exit (0);
}
}
Please help!